I’m a novice with jQuery and it probably a simple answer but I’m trying to calculate the price and quantity if a checkbox is checked. I loop through a list of items and the user selects the checkbox and enters the quantity and I’d like it to total in the last cell.
<table>
<tr>
<td width="10%"> </td>
<td width="80%">Item</td>
<td width="10%">Price</td>
<td width="10%">Quantity</td>
<td width="10%">Total</td>
</tr>
<tr>
<td > <input type="checkbox" name="Extras" value="id" checked="no"></td>
<td >ItemName</td>
<td><cfinput type="text" name="quantity" class="quantity" size="4"></td>
<td>#Extras.Price #</td>
<td><span id="total"></span></td>
</tr>
</table>
So far I have the following for my jQuery:
$(document).ready(function() {
$("input[type=checkbox]:checked").each (function (){
// not sure what to put here
});
});
Thanks for the help!
I think you try to do something like this, check it here: http://jsfiddle.net/vNg9v/2/
Script:
Html:
Now this should be exactly what you want?