jQuery Validation with Bootstrap Tabs -


i have form multiple bootstrap tabs , inside them multiple input , select fields, required , not.

i using jquery validation plugin validate form. below highlight , unhighlight errors using bootstrap css working fine:

    highlight: function(element) {         $(element).closest('.input-group').addclass('has-error');     },     unhighlight: function(element) {         $(element).closest('.input-group').removeclass('has-error');     }, 

what need if tab has not validated field, want tab highlight.

i used below code, funny thing code works , highlights tab red colour, , doesn't work.

if($(".tab-content").find("div.tab-pane:has(div.has-error)").length != 0){     $(".tab-content").find("div.tab-pane:has(div.has-error)").each(function(index, tab){         var id = $(tab).attr("id");          $('a[href="#' + id + '"]').tab('show').addclass('bg-danger');     }); } else {     $(".nav-tabs li a").each(function(){         if($(this).hasclass('bg-danger')){             $(this).removeclass('bg-danger');         }     }); } 

what doing wrong , how can highlight tabs if there required field error?


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -