I have 2 checkboxes. I need one, not both, but at least 1 to be checked. It is not a multiple selection but zero is not accepted. If one is checked, this line will work jQuery('#wiz_menu.nav-tabs > .active').next('li').find('a').trigger('click'); otherwise it should alert. The following makes it alerting all the time.
UPDATE
I am not using the submit button or I would have used the validate plugin. It is a normal button to go next in the wizard <button type="button" class="btnNext">Next step</button>
HTML
<div class="form-group"> <label for="usp-category-8" class="usp-checkbox usp-cat usp-cat-0"> <input type="checkbox" name="usp-category[]" id="usp-category-8" value="8" data-required="true" class="usp-input usp-input-category"> Cultura </label> <label for="usp-category-7" class="usp-checkbox usp-cat usp-cat-0"> <input type="checkbox" name="usp-category[]" id="usp-category-7" value="7" data-required="true" class="usp-input usp-input-category"> Scienze </label> <input type="hidden" name="usp-category-required" value="1"> </div> JS
jQuery('.btnNext').on("click", function(){ if(jQuery(".tab-pane").is("#step1")) { var isChecked = false; $('input[type=checkbox]').on("change", function () { isChecked = true; }); if ( isChecked ) { jQuery('#wiz_menu.nav-tabs > .active').next('li').find('a').trigger('click'); } else { alert( 'Please, check at least one checkbox!' ); } } });