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 success.
Thanks all for help!
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 success.
Thanks all for help!
Share Improve this question edited Jun 3, 2011 at 7:45 Reporter 3,9485 gold badges35 silver badges49 bronze badges asked Jun 3, 2011 at 7:42 metaforcemetaforce 1,3775 gold badges17 silver badges26 bronze badges 2-
Does
selected
meanchecked
? Can you post the relevant parts of your markup, and the code you have so far? – Frédéric Hamidi Commented Jun 3, 2011 at 7:45 - Please post your html and javascript source code. For help we have to take look on it. – Reporter Commented Jun 3, 2011 at 7:46
2 Answers
Reset to default 11Assuming 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)
...