I need to disable all the check boxes inside a table cell when clicking on a hyperlink inside the same table.
I'm using the following jquery code to select all the check boxes nested inside the table.
$el = $(this).parents('table:eq(0)')[0].children('input[type="checkbox"]');
$($el).attr('checked', true);
For some reason this piece of code is not working.
Can anyone show me how to fix it?
Clicking on the master checkbox selects all checkboxes; and unchecking it, deselects all checkboxes.
In general, the checkbox disabling in jQuery is defined as disabling the checkbox element which grays out the checkbox element which can either be checked or unchecked when it is disabled by using different methods provided in jQuery such as using a prop() and attr() method and there is also one property which can be ...
$('table input[type=checkbox]').attr('disabled','true');
if you have an id for the table
$('table#ID input[type=checkbox]').attr('disabled','true');
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