Relative newbie jQuery:
I want to display a set of flags from which the user can select five.
I have jquery code that is checked in jsfiddle, but it obviously does nothing.
Can anyone see what obvious thing I am missing?
I have a set of checkboxes and then the following javascript:
function countChecked() { var n = $("input:checked").length; alert(n); if (n == 5) { $(':checkbox:not(:checked)').prop('disabled', true); } else { $(':checkbox:not(:checked)').prop('disabled', false); } } $(":checkbox").click(countChecked);
jsfiddle here
source share