Skip to content Skip to sidebar Skip to footer

Jquery - How To Show Message If > 1 Checkbox Selected?

Depending on the number n of cars a user has in his records, there will be n checkboxes to select from. In my view these checkboxes are rendered using a loop

Solution 1:

How to show message if > 1 checkbox selected?

You could check the length property of the :checked checkboxes.

if ($('.checkbox:checked').length > 1) { 
   // Show message.
};

jsFiddle.

Also, you could select those checkboxes with :checkbox selector.

Post a Comment for "Jquery - How To Show Message If > 1 Checkbox Selected?"