How to find all unselected checkboxes?

后端 未结 2 1815
梦毁少年i
梦毁少年i 2021-02-19 22:26

In jQuery, how does one go about finding all the \'unchecked\' checked boxes.

$(\':checkbox:checked\');

appears to be me all checked boxes, but

2条回答
  •  猫巷女王i
    2021-02-19 22:55

    A solution without special jQuery selectors, using the attribute selector [docs] and .filter() [docs]:

    $('input[type="checkbox"]').filter(function() {
        return !this.checked;
    });
    

提交回复
热议问题