I need help with jQuery selectors. Say I have a markup as shown below:
<form>
<table>
<tr>
<td><input type="checkbox" id="select_all" /></td>
</tr>
<tr>
<td><input type="checkbox" name="select[]" /></td>
</tr>
<tr>
<td><input type="checkbox" name="select[]" /></td>
</tr>
<tr>
<td><input type="checkbox" name="select[]" /></td>
</tr>
</table>
</form>
How to get all checkboxes except #select_all when user clicks on it?
A more complete example that should work in your case:
When the
#select_allcheckbox is clicked, the status of the checkbox is checked and all the checkboxes in the current form are set to the same status.Note that you don’t need to exclude the
#select_allcheckbox from the selection as that will have the same status as all the others. If you for some reason do need to exclude the#select_all, you can use this: