there is a code
$(function() { var form = $("form"); var tab = form.find(".tab"); var current_index = 0; var len = tab.length; var back = $(".back"); var next = $(".next"); var submit = form.find("input[type=submit]"); function show() { submit.toggle(current_index == len - 1); next.toggle(current_index < len - 1); back.toggle(current_index > 0); tab.hide().eq(current_index).show() } show(); function audit(current_tab) { var elems = $(".required", current_tab); return [].every.call(elems, function(el, i) { var ok = el.value.trim(); ok && +ok != 0 ? el.classList.remove("empty_field") : el.classList.add("empty_field"); return ok && ok != "0" }); } next.on("click", function(event) { event.preventDefault(); var current_tab = tab.eq(current_index); var required = audit(current_tab) if (required) { current_index++; show() } }); back.on("click", function(event) { event.preventDefault(); current_index--; show() }); form.on("input change", ".required", function(event) { var ok = this.value.trim(); ok && ok != "0" && this.classList.remove("empty_field") }) form.on("submit", function(event) { return audit(form) }) submit.on("click", function(event) { return audit(form) }) }); How to apply the condition not only to .required, but also to several others (for example #parent_cat_id, #category_id and .city-input if its value = 0 ,?
In action http://plnkr.co/edit/qO8z7dk5FwruwzO2uAYf?p=preview
Thank.