Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - How to select all checkboxes EXCEPT a specific one?

I have a jQuery selector that looks like this ...

$("input:checkbox").click(function(event) {
  // DO STUFF HERE
}

Everything was working well until I was asked to add another checkbox that has nothing to do with the original checkboxes. How do I create a selector for all checkboxes except for one? Thank you.

like image 688
webworm Avatar asked Sep 23 '11 02:09

webworm


1 Answers

$('input:checkbox:not("#thatCheckboxId")').click(function(event) {
  // DO STUFF HERE
}

Just give the checkbox in question a unique id=""

like image 116
JohnD Avatar answered Nov 15 '22 09:11

JohnD