I created a jQuery function to check if a checkbox is checked like so:
if ($('input:checkbox:checked').length > 0){ }
I have two set of check boxes in two separate forms. When I use above code it checks for checkboxes in both forms. I want the if condition only for one form. How can I achieve it?
You can use
:eq()selector. Try the following:please note that
:checkboxselector is deprecated you can useinput[type="checkbox"]instead.