How to automatically sum some text field without clicking button for sum it?
<tbody>
<tr>
<td>
<div class="form-group">
<label for="exampleFormControlTextarea1">result
<a href="JavaScript:value();" class="badge badge-primary">SUM</a>
</label>
<input type="text" class="form-control" id="add" name="sum4" readonly>
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group">
<label for="exampleFormControlTextarea1">Nilai Akhir/100</label>
<input type="text" class="form-control" id="addme" name="result4" readonly>
</div>
</td>
</tr>
</tbody>
and this is the JavaScript.
function value()
{
var input1 = document.getElementById("totalindex1").value;
var input2 = document.getElementById("totalindex2").value;
var input3 = document.getElementById("totalindex3").value;
var result = 0;
var divider = 100;
var resdiv = 0;
result += parseInt(input1) + parseInt(input2) + parseInt(input3);
resdiv = result / divider;
document.getElementById('add').value = result;
document.getElementById('addme').value = resdiv;
}
the variable "totalindex1", "totalindex2", and "totalindex3" already automatically sum for every button checked. I want to make sum for each totalindex as final result without clicking button for sum these variable.
value()
in whatever place generates the content of thetotalindexX
elements.