..I am counting the number of checked checkboxes and when the max number is reached I need to make sure no other checkbox is allowed to be selected.
like this....
IF(..some condition..)
{
// do the deed
}
ELSE
{
$('input[type="checkbox"]').on('click', function(event)
{
$(this).parent().removeClass("c1-item-selected"); // removing CSS
$(this).parent().val=""; // hoping to remove value "checked"
});
}
I tried to replace the $(this).parent().val=""; with: event.preventDefault(); event.stopPropagation(); but it was not the right choice of methods. It still allowed me to check any box and actually prevented me from unchecking it afterwards. So I thought I would simply set the value of any clicked checkbox to null or ("") and remove the styling so it all looks like no other checkbox is allowed to be selected but it did not seem to take :)
Any ideas how to prevent the checkbox to be checked when the ELSE statement is reached ?