简体   繁体   中英

finding all checkboxes that are NOT checked

If I wanted to select all checkboxes that are selected, I could do this.

$('#mydiv input[type=checkbox]:checked')

Is there a similarly simple syntax that lets me select all the checkboxes that are NOT selected?

Hiya yep: demo http://jsfiddle.net/usvrb/

http://api.jquery.com/not-selector/

quote

  The .not() method will end up providing you with more readable selections than pushing complex selectors or variables into a :not() 

selector filter. In most cases, it is a better choice.

Hope this helps, :) cheers!

 $('#mydiv input[type=checkbox]:not(:checked)')

You won't believe it.

$('#mydiv input[type=checkbox]').not(':checked')

EDIT : Stackoverflow management, whats going on with the nuts CAPTCHA? Every single answer today requires me to enter a CAPTCHA code?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM