Bootstrap tab change event using Jquery
In this lesson we are going to learn about the Change event of "bootstrap tab" which is useful to load dynamic data instead of loading iterative loops for certain time intervals.We may reduce this by using tabs if we have .
If you are using Bootstrap with Jquery then it will definitely be useful .
Jquery
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
alert('Hello,I"m changing');
});
HTML
<div class="tab" role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#1" aria-controls="1" role="tab" data-toggle="tab">Hello</a></li>
<li role="presentation"><a href="#2" aria-controls="2" role="tab" data-toggle="tab">How are you?</a></li>
</ul>
<div class="tab-content tabs ">
<div role="tabpanel" class="tab-pane active" id="1">
I am tab 1
</div>
<div role="tabpanel" class="tab-pane active" id="2">
I am tab 2
</div>
</div>
</div>
It will be helpful to load or refresh contents dynamically for some cases.
If you are using Bootstrap with Jquery then it will definitely be useful .
Jquery
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
alert('Hello,I"m changing');
});
HTML
<div class="tab" role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#1" aria-controls="1" role="tab" data-toggle="tab">Hello</a></li>
<li role="presentation"><a href="#2" aria-controls="2" role="tab" data-toggle="tab">How are you?</a></li>
</ul>
<div class="tab-content tabs ">
<div role="tabpanel" class="tab-pane active" id="1">
I am tab 1
</div>
<div role="tabpanel" class="tab-pane active" id="2">
I am tab 2
</div>
</div>
</div>
It will be helpful to load or refresh contents dynamically for some cases.
Comments
Post a Comment