I need to get the id from each checked checkbox. Right now I am able to get the sum which is great but I cant seem to get each id.
<input name="pay" class="pay_me" id="4" type="checkbox" value="6.00" />
<input name="pay" class="pay_me" id="5" type="checkbox" value="9.00" />
<input name="pay" class="pay_me" id="6" type="checkbox" value="3.00" />
<input name="pay" class="pay_me" id="9" type="checkbox" value="23.00" />
Jquery
$(document).ready(function() {
$('.pay_me').change(
function() {
var t_payme = 0;
$('.pay_me:checked').each(function() {
t_payme += parseFloat($(this).val());
});
t_payme = parseFloat(t_payme).toFixed(2);
$('#to_payme').val(t_payme);
});
});
With this I can the sum to my textbox
<input name="to_payme" id="to_payme" type="text" value="0.00" />
I also need the checked ID numbers like this 4|6|9 in an additional textbox
<input name="ids_to_update" id="ids_to_update" type="text" value="" />
Here you go:
on jsFiddle