我正在使用jquery ui tabs ..我想要做的是从javascript我试图在tab1的某些事件后显示第二个标签。我使用以下代码更改为tab2实际上没有发生..在这里做错了什么?
jquery的:
$(this.el).find("#ui-id-8").parent(".ui-state-default .ui-corner-top").attr({'tabindex':'0', 'aria-selected':'true'}).addClass("ui-tabs-active ui-state-active").show();
HTML
<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist">
<li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active" role="tab" tabindex="0" aria-controls="asociateconddiv" aria-labelledby="ui-id-1" aria-selected="true"><a href="#asociateconddiv" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-1">Campaign Details</a></li>
<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="createconditiondiv" aria-labelledby="ui-id-2" aria-selected="false"><a href="#createconditiondiv" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-2">Scenarios</a></li>
<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="assoctrulegroupdiv" aria-labelledby="ui-id-3" aria-selected="false"><a href="#assoctrulegroupdiv" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-3">Confirm & Run</a></li>
</ul>
答案 0 :(得分:1)
您可以在jquery ui标签中设置活动标签,如下所示:
$('#tabs').tabs({active: 1});
有效将值视为零。
检查demo
同时查看详细信息API documentation