Accessing all Inputs
If all your inputs will have the class "form-control offered-price" you can access them as an array of HTML elements like so var inputs = document.querySelectorAll(".form-control.offered-price");
Appending HTML
To append any HTML after an element, use element.insertAdjacentHTML("afterend",yourHTML); where yourHTML is a string containing valid HTML. You can also create an HTML element using var myChildElement = document.createElement("div") and then append that element to a parent element using myParentElement.appendChild(myChildElement);
Summation of all input values
One approach would be to attach an event listener to each input so that the div gets the recalculated sum every time an input changes, as in the code below.
var inputs = document.querySelectorAll(".form-control.offered-price");
inputs[inputs.length-1].insertAdjacentHTML("afterend","<div id='price_result'>");
(function(arr){
for(var i = 0; i < arr.length; i++){
if(arr[i].addEventListener){
arr[i].addEventListener("keyup",function(){
document.getElementById("price_result").innerHTML = sumValues(arr);
});
}else{
arr[i].attachEvent("onkeyup",function(){
document.getElementById("price_result").innerHTML = sumValues(arr);
});
}
}
})(inputs);
function sumValues(arr){
var sum = 0;
for(var i = 0; i < arr.length; i++){
sum += Number(arr[i].value,10);
}
return sum;
}
<input type="text" id="rfq_ironilbundle_quotes_offer_price_0" name="rfq_ironilbundle_quotes[offer_price][0]" required="required" class="form-control offered-price">
<input type="text" id="rfq_ironilbundle_quotes_offer_price_1" name="rfq_ironilbundle_quotes[offer_price][1]" required="required" class="form-control offered-price">
<input type="text" id="rfq_ironilbundle_quotes_offer_price_2" name="rfq_ironilbundle_quotes[offer_price][2]" required="required" class="form-control offered-price">