开发者

Check if more than one checkbox is selected in jQuery

开发者 https://www.devze.com 2023-03-10 07:39 出处:网络
I need to know if more than one checkbox is selected from my list. How to achive this using jQuery? I\'ve tried something with :checked, but no s开发者_开发知识库uccess.

I need to know if more than one checkbox is selected from my list.

How to achive this using jQuery?

I've tried something with :checked, but no s开发者_开发知识库uccess.

Thanks all for help!


Assuming your container will have an id

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

See a working demo


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

精彩评论

暂无评论...
验证码 换一张
取 消