Hi I am trying to create a form using HTML where users can insert numbers in form number 1 and form number 2. Once the 2 forms are filled with numbers the total shows automatically in the lower row without a submit button.
Note that the forms are Django Forms
Here is what I have tried.
var item_1_amount = document.getElementById("item_1_amount");
var item_2_amount = document.getElementById("item_2_amount");
var total = item_1_amount.value + item_2_amount.value
item_1_amount.onkeyup = function () {
document.getElementById("Total").innerHTML = total.value;
};
<tr>
<td><h6 style="float:left; margin-right:5px; margin-top:7px">$</h6>
<input
autocomplete="off"
type="number"
class="form-control w-25"
name="item_1_amount"
id="item_1_amount"
style="float:left"/>
</td>
<td><h6 style="float:left; margin-right:5px; margin-top:7px">$</h6>
<input
autocomplete="off"
type="number"
class="form-control w-25"
name="item_2_amount"
id="item_2_amount"
style="float:left"/>
</td>
</tr>
<tr>
<th>Total</th>
<th id="Total">$$</th>
</tr>