Why do you even use the .validate plugin when you write a little javascript yourself. Press, just check the value of the inputs (for example, $ ('# myInput'). Val (). Trim () == "") and show / hide the corresponding div with each input.
In addition, for multi-parameter verification, check only the required fields and continue with what needs to be done.
$('#btn-next').click(function() { var amountValid = $('#donation_amount').val().trim() == '' ? false : true; var infoValid = $('#personal_information').val().trim() == '' ? false : true; if (amountValid && infoValid) { var old = $('.active'); var oldOrder = old.attr('data-order'); var newOrder = parseInt(oldOrder) + 1; old.removeClass('active'); $("[data-order='" + newOrder + "']").addClass('active'); curOrder = newOrder; }else{ console.log("invalid"); } });
Taha rehman siddiqui
source share