簡體   English   中英

檢查 jQuery 中是否選中了多個復選框

[英]Check if more than one checkbox is selected in jQuery

我需要知道是否從我的列表中選擇了多個復選框。

如何使用 jQuery 實現這一目標?

我已經嘗試過:checked ,但沒有成功。

謝謝大家的幫助!

假設您的容器將有一個 id

if ($("#containerID input:checkbox:checked").length > 1) {
   // your code goes here
}

查看工作演示

var n = $("input:checked").length;
if (n >= 2)
   ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM