【问题标题】:How to loop through all unchecked checkboxes?如何遍历所有未选中的复选框?
【发布时间】:2010-11-21 20:45:24
【问题描述】:

使用 jQuery,有没有一种快速的方法来循环浏览具有 className="carCheckboxes" 的页面上的所有 unchecked 复选框。

【问题讨论】:

    标签: javascript jquery checkbox


    【解决方案1】:

    .each() 方法与:not(:checked) 选择器一起使用。以下是参考资料:

    Reference to jQuery.each method

    Reference to jQuery:not selector

    Reference to jQuery:checked selector

    $("input.carCheckboxes:not(:checked)").each (function () {
      //your code to loop through each element.
      //$(this) references the current element as a jQuery Object
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-19
      • 1970-01-01
      • 1970-01-01
      • 2013-09-12
      • 1970-01-01
      • 2016-12-31
      • 2022-01-20
      相关资源
      最近更新 更多