Reputation: 785
im using the standard jquery tabs 1.3.2 to load a list of bookmarks in each tab pane.
If a tab is clicked before the dom is ready the ajax page is loaded by itself. I don't want that to happen so how can I stop that behavior?
<ul id="tool-tabs" class="tabs clearfix">
<li class="ui-tabs-selected"><a href="#tools">Tools</a></li>
<li><a id="bookmarks" href="/ajax.bookmarks.php">Bookmarks</a></li>
<li><a id="favorites" href="/ajax.favorites.php">Favorites</a></li>
</ul>
If i click Bookmarks as the page loads i get the the ajax page loaded to /mysite/ajax.bookmarks.php which i don't want.
Thanks in advance.
Upvotes: 0
Views: 256
Reputation: 8463
$(document).ready(function(){
//once dom get ready it happens
$('#bookmarks').trigger('click');
$("#bookmarks").click(function(e){
e.preventDefault();
});
});
Run your ajax codes and onsuccess of your ajax once again activate it.
Upvotes: 0
Reputation: 82943
Are you sure you are calling the tabs() function of jquery in the $(document).ready() method? If this is the case you should not have a problem.
Upvotes: 0
Reputation: 27916
Simplest thing is probably set the default style for the tab group to display: none
, and then make it visible after the page is done loading. You could also trying adding a onClick="return false"
to disable them and then clear those with jQuery once they're ready for use.
Upvotes: 2