sum text field depend on the other drop down's value
Posted: Mon Sep 05, 2016 9:49 am
I want six rows, I want to get the sum for all sumK1, sumK2 ,sumK3for(int i=0; i<=6, i++){
<tr>
<td><span class="amtxt" >
<input type="text" name=amacount></span>
</td>
<td class="w6"><select id="level" class="sum" name="level" size="1">
<option value="">-- Please select --</option>
<option value="K1">K1</option>
<option value="K2">K2</option>
<option value="K3">K3</option>
</select></td>
</tr>
}
so far I have, but did not get what I want
Code: Select all
$(".sum").each(function() {
if ($(this).children().val() == "K1") {
alert(am_value + $(this).children().val());
sumk1+=(!isNaN(am_value) && $.isNumeric(am_value)) ? parseInt(am_value) : 0;
}
});