How To Select A Checkbox Jquery Object
Why my jquery object didn't get checked with $('.checkall').checked = true ; Here's a Fiddle. UPDATE : working code
Solution 1:
This is a problem of mixing jQuery, and DOM, methods. jQuery doesn't have access to the .value
property of the node, instead use:
$('.checkall').prop('checked',true);
Reference:
Solution 2:
You need this:
$('.checkall').prop('checked',true);
Or:
$('.checkall')[0].checked = true ;
You would use .prop()
to set the property of checked
or directly covnert the jQuery element to HTMLElement
and then directly set the value.
Solution 3:
Use .prop()
$('.checkall').prop('checked',true)
Post a Comment for "How To Select A Checkbox Jquery Object"