Reputation: 103
Given this checkbox:
<input data-index="7" data-name="Sector-108" type="checkbox">
how do I uncheck this checkbox based on the data-name
attribute selector?
Upvotes: 0
Views: 3970
Reputation: 27364
You can use it as below.
$('input').hasAttr('data-name').attr('checked','checked');
Upvotes: 0
Reputation: 148140
You can use attribute selector
$('[data-name=Sector-108]').prop('checked',true);
You can use attribute selector starts with wild card to get all the elements having name like Sector-
$('[data-name^=Sector-]').prop('checked',false);
Upvotes: 1