(08-25-2018, 12:18 AM)Wouter60 Wrote: Give the inputs for the number of sets a name also: name="sets[]".
Remove the onChange part that you already have.
Then, in the jQuery part that starts with $(document).ready .. insert this:
Code:
$("input[name='sets[]']").change(function(){
row = $(this).parents('tr');
n = $(this).val();
f = row.find("input[name='india[]']").val();
total = n * f;
alert(total);
});
Now, if you change any of the inputs with the name "sets[]", it will trigger a calculation.
Not working
************
echo '<td id="textone_'.$row['id'].'">'.$row['fee']. '</td>';
echo '<td id="texttwo_'.$row['id'].'">
<input type="number" min="0" max="999" name="india"
class="txtbox" disabled="disabled" ></td>';
echo '<td> <input type="text" value="0"
id="result_'.$row['id'].'" name="result"></td>';
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input[name='sets[]']").change(function(){
row = $(this).parents('tr');
n = $(this).val();
f = row.find("input[name='india[]']").val();
total = n * f;
alert(total);
});
</script>