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

前端 未结 4 2084
余生分开走
余生分开走 2021-01-05 12:42

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

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

Everything was working

4条回答
  •  情深已故
    2021-01-05 13:08

    If all the checkboxes are within another element, you can select all checkboxes within that element.

    Here is an example with one parent element.

    The jQuery below also works with multiple divs as well:

    jQuery:

    $('.test input:checkbox')
    

    That selects just the checkboxes within any element with class "test".

    -Sunjay03

提交回复
热议问题