Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
679 views
in Technique[技术] by (71.8m points)

selecting & loading a jquery tab programmatically

I'm having trouble trying to get this functionality to work. I would like to load a tab automatically when the page loads. I have used the following code.

$tabs.tabs('select', 0); 

However, what's happening is that it's only selecting it and not loading it (that tab loads via ajax). Interestingly when I select another tab and then go back to the 1st tab again then it loads fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I just answer to this question to avoid people to misguide with deprecate functions.

Most of the answers were correct at the time of the question, but most of them were not using in new API.

try following code If you are using new API.

$(function() { 
    $( "#tabs" ).tabs(); 
    $( "#tabs" ).tabs( "option", "active", 2 ); 
});

For more details check following link.

http://jqueryui.com/upgrade-guide/1.9/#deprecated-select-method


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...