Hi I am using the following code to create tabbed layout using twitter bootstrap
<ul class="nav nav-tabs" >
<li class="active"><a href="#" data-toggle="tab">Request Audit</a></li>
<li><a href="#" data-toggle="tab">status</a></li>
<li><a href="#" data-toggle="tab">Settings</a></li>
<li><a href="#" data-toggle="tab">Help</a></li>
</ul>
now in all tabs i need different page to load.So i want to do this :
<ul class="nav nav-tabs" >
<li class="active"><a href="#" data-toggle="tab">Home</a></li>
<li><a href="status.html" data-toggle="tab">status</a></li>
<li><a href="settings.html" data-toggle="tab">Settings</a></li>
<li><a href="help.html" data-toggle="tab">Help</a></li>
</ul>
I don’t want to load the content from same page in all tabs and above code is not loading new page.Please help..
update :
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#audit">Request Audit</a></li>
<li><a href="#status">status</a></li>
<li><a href="#settings">Settings</a></li>
<li><a href="#help">Help</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="audit">
<p>audit</p>
</div>
<div class="tab-pane" id="status">
<p>status</p>
</div>
<div class="tab-pane" id="settings">
<p>settings</p>
</div>
<div class="tab-pane" id="help">
<p>help</p>
</div>
</div>
I have added this script
<script>
$('#myTab a[href="#status"]').click(function (e) {
e.preventDefault();
$(this).tab('show');
$('#status').load('status.html');
});
</script>
There are several ways to do this, but before deciding which one to use, I’d want to make sure you actually want to piece out your files like that. What’s keeping you from just putting the content inside of the tabs on the page as it is?
If not, why not use PHP?
If you decide to stick with your current plan, the way I’d accomplish what you’re looking to do would be through jQuery and AJAX.
First, you want to make sure you’re using the proper Bootstrap structure – check out the Tabbable Nav section, and make your markup tabs correspond to empty content areas:
Then, use jQuery.load to fill in the
tab-panes!