How can I say in jQuery –
Sum the “value” of all checkboxes within each div.checkboxes and put the summed value to the next ?
<td>
<div class=checkboxes>
<LABEL style="white-space: nowrap;">
<INPUT type="checkbox" name="user_registered" class="checkbox1" value="14" >
</LABEL><BR>
<LABEL style="white-space: nowrap;">
<INPUT type="checkbox" name="user_registered" class="checkbox2" value="12" >
</div>
</td>
<td>
<td> </td>
<td>
<div class=checkboxes>
<LABEL style="white-space: nowrap;">
<INPUT type="checkbox" name="user_registered" class="checkbox1" value="24" >
</LABEL><BR>
<LABEL style="white-space: nowrap;">
<INPUT type="checkbox" name="user_registered" class="checkbox2" value="22" >
</div>
</td>
<td>
<td> </td>
You can do it like this:
You can give it a try here, you’ll want to change
.find(":checkbox")to.find(":checkbox:checked")if you only want to sum the checked values.