javascript - Onload bootstrap tab trigger -


the active class isn't working , i've tried body on-load click trigger , show tab using id , many other ways, nothing seems working. have hashed url enable tabs linked individually in search. appreciated.

js: hash url , jump tab

// jump tab if exists  if (location.hash) {   $('a[href=' + location.hash + ']').tab('show');   }    // add tab hash url persist state   $(document.body).on("shown.bs.tab", function(e){   location.hash = e.target.hash;   });  }); 

js: go tab home (not working)

$("document").ready(function(){ $("#home").trigger("click"); }); 

html:

<div class="col-xs-5 col-md-2 nopadding">   <nav class="nav-sidebar">     <ul class="nav tabs">     <li class="lead3"><a href="#home" class="active" data-toggle="tab">home </a></li>    <li class="lead3"><a href="#tab1" data-toggle="tab">tab1</a></li>    <li class="lead3"><a href="#tab3" data-toggle="tab" >tab3</a></li>                                   <li class="lead3"><a href="#contact" data-toggle="tab"> contact </a></li>                                                                                                                     </ul> </nav> 

tab-pane:

<div class="tab-pane active fade text-style" id="home"> . .. </div> 

what expect line?

$("home").trigger("click"); 

i suppose jquery can't find element here $("home"). evaluate in console check. if going find element class 'home' or id 'home' should use $(".home") or $("#home") properly.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -