I am using Bootstrap. I have a table with a checkbox in a header and in each collumn. I am trying to make "check all" functionality on jQuery, but it seems that bootstrap does not use checked attribute. As I see, it adds span tag around my checkbox and adds a class 'checked' to it. Is there any possibility to work with checked attr, or I must forget about it and write class checking and switching?
Below goes the part of code from the result HTML:
<td>
<div class="checker">
<span class="">
<input type="checkbox" class="payout_check" style="opacity: 0;">
</span>
</div>
</td>
This is unchecked one. The it is checked, third row changes to:
<span class="checked">
You could use prop. I faced the same issue. On checking a checkbox, the attribute checked came as undefined. When i changed it to prop, it gave true and false value based on the state of the check box.
$('#checkboxId').prop('checked');
this work for uncheck
jQuery('span', $('#uniform-You_id_checkbox')).removeClass("checked");
$('#You_id_checkbox').removeAttr("checked");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With