I am trying to programatically change tabs as below:
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#step1" data-toggle="tab" >Step 1</a></li>
<li><a href="#step2" data-toggle="tab" >Step 2</a></li>
</ul>
<div class="tab-content" id="tabs">
<div id="step1" class="tab-pane fade in active">
</div>
<div id="step2" class="tab-pane fade">
</div>
</div>
JS(upon certain condition):
$('a[href="#step2"]').tab('show');
This does not work and I get the error: TypeError: $(...).tab is not a function
Any ideas?
EDIT:
To be sure, I also included the following in my _Layout file as per bootstrap website:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
Which browswer are you using? the integrity attribute doesn't seem to be fully integrated yet (see the mozilla compatibility list)
I tried this code without cdn link and worked just fine. on the other hand, with the integrity attribute, i got the same error as you at first, but upon reload it worked (tried on chrome 49 and firefox 45.0.2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With