jQuery 1.7.1, jQuery UI tabs. I have the following HTML representing tabs,
<div id="tabs">
<ul>
<li><a href="t1" title="content">Gallery</a></li>
<li><a href="t2" title="content">Polls</a></li>
<li><a href="t3" title="content">Events</a></li>
</ul>
<div id="content"></div>
</div>
I need to show an indicator in the ‘content’ div container when I click or select the tab. I tried the following,
HTML
<div id="content"><img id="ind" src="images/indicator.gif"
alt="Loading..." style="display:none"/></div>
JavaScript
$.ajaxSetup({
cache:false,
beforeSend: function() {
$('#ind').show()
},
complete: function(){
$('#ind').hide()
},
success: function() {}
});
This is working with the following tab select code, which I execute to select a default tab when the page loads,
var $tabs = $('#tabs').tabs();
$tabs.tabs('select', 1);
But whenever i click on the tab, indicator is not displaying. Any idea why?
You haven’t call any ajax in tab selection.
if you are calling tab content by ajax that indicator will display.
I have test this with small example, added below.
New Code with extra JQuery Plugin