I want to disable only checkboxes that are checked AND have a specific class. There are a lot of very similar questions but I couldn’t find anything that was able to get this working.
http://jsfiddle.net/silvajeff/snfDM/
In the below example only the second item should be disabled:
HTML:
<input type="checkbox" class='boundParent' />
<input type="checkbox" class='boundParent' checked/>
<input type="checkbox" class="boundChild" />
<input type="checkbox" class="boundChild" />
Javascript:
$('[input:checked][class*="boundParent"]').prop("disabled", true);
1 Answer