Reputation: 163
My Html Code is
<nav class="nav-sidebar">
<ul class="nav tabs" id="myTab">
<li class="active" ><a href="#tab3" data-toggle="tab" >Tabl 1</a> </li>
<li class="tab2"><a href="#tab2" data-toggle="tab">Tab 2</a></li>
<li ><a href="#tab3" data-toggle="tab">Tab 3</a></li>
<li ><a href="#tab4" data-toggle="tab">Tab 4</a></li>
<li><a href="#tab5" data-toggle="tab">Tab 5</a></li>
</ul>
And in My .ts
$('#myTab a').click(function(e) {
e.preventDefault();
$(this).tab('show');
});
$("ul.nav-tabs > li > a").on("shown.bs.tab", function(e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});
var hash = window.location.hash;
$('#myTab a[href="' + hash + '"]').tab('show');
Tried so many from stackoverflow and other web sites but i ended up with 'tab' doesn't exist in jquery
Upvotes: 2
Views: 3424
Reputation: 889
jQuery does not have a function tab()
;
Maybe you should import a Expansion witch add a function tab()
into jQuery!
And if you us UI framework, you need to introduce the corresponding resources!
Upvotes: 0
Reputation: 2342
Seems like you're confusing tab()
with tabs()
.
Read more here: http://api.jqueryui.com/tabs/
Upvotes: 0