<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li class=""><a href="#profile" data-toggle="tab">Profile</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="home">
home tab. Takes some time to load. “Programs must be written for people to read, and only incidentally for machines to execute.” ― Hal Abelson
“ Java is to JavaScript what Car is to Carpet. ” - Chris Heilmann
“ It's hard enough to find an error in your code when you're looking for it; it's even harder when you've assumed your code is error-free. ” - Steve McConnell
</div>
<div class="tab-pane fade" id="profile">
profile tab!
</div>
</div>
<div id=debug></div>
<button id=clr>clear</button>
$("a[href='#home']").on('shown.bs.tab', function(e) {
log('shown - after the tab has been shown');
});
// or even this one if we want the earlier event
$("a[href='#home']").on('show.bs.tab', function(e) {
log('show - before the new tab has been shown');
});
//////////////////// just some logging help //////////
$log = $('#debug');
$('#clr').click(function() {
$log.empty();
});
log = function(msg) {
d = new Date();
time = "" + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds() + ':' + d.getMilliseconds();
$log.prepend(time + ' ' + msg + '<br>');
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.