How to count checked checkboxes?


i want to create form which has got 10 questions and the questions have to be only a checkbox.

now. my problem is, the visitors have to answer 3 questions. i have to disable or lock the the other 7 checkboxes if the visitor select 3 checkboxes.

how can i control this on client side?

Maybe this helps you:

Thanks, it helps me for counting checked checkboxes… so the important one is that;

how can i disable other checkboxes?

You can use :not selector, for example:

$("input:not(:checked)").attr("disabled", "disabled");

an example?

or does someone have an other idea?

highwind has just posted how to disable those unchecked boxes :)