如何使用jQuery选项卡以编程方式选择给定选项卡
例如:页面加载时,选择标签1(从零开始)
答案 0 :(得分:0)
得到答案here
您初始化标签,然后选择所需标签。
$(function() {
$( "#TabIdentifierIdInYourHTML" ).tabs();
$( "#TabIdentifierIdInYourHTML" ).tabs( "option", "active", 2 );
});
答案 1 :(得分:0)
试试这个:
$('#tabs').tabs({
select: function(event, ui) { // select event
$(ui.tab); // the tab selected
ui.index; // zero-based index
},
show: function(event, ui) { // show event
$(ui.tab); // the tab shown
ui.index; // zero-based index
}
});
答案 2 :(得分:0)
你可以简单地做到这一点
$("#id").tabs( "select" , 1);