Reputation: 6236
Why my jquery object didn't get checked with $('.checkall').checked = true ;
Here's a Fiddle.
UPDATE : working code
Upvotes: 0
Views: 47
Reputation: 253308
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:
Upvotes: 4
Reputation: 59232
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.
Upvotes: 3