Javascript 从另一个函数中调用twitter引导选项卡函数
使用bootstrap-tab.js,我想激活一个选项卡,从另一个函数中调用它。 Html: 我不熟悉javascript/jQuery [编辑]我将原来的页面精简到上面所示的内容,效果良好。因此,可能与其他功能发生冲突。很抱歉浪费了你的时间。如果你不想试试这个Javascript 从另一个函数中调用twitter引导选项卡函数,javascript,jquery,twitter-bootstrap,Javascript,Jquery,Twitter Bootstrap,使用bootstrap-tab.js,我想激活一个选项卡,从另一个函数中调用它。 Html: 我不熟悉javascript/jQuery [编辑]我将原来的页面精简到上面所示的内容,效果良好。因此,可能与其他功能发生冲突。很抱歉浪费了你的时间。如果你不想试试这个 <script> jQuery(function($){ function activate_tab(){ //process other data...then goto ta
<script>
jQuery(function($){
function activate_tab(){
//process other data...then goto tab
alert(1);
$('#nav_tabs li:eq(2) a').tab('show');
alert(2);
}
});
</script>
jQuery(函数($){
函数激活_选项卡(){
//处理其他数据…然后转到选项卡
警报(1);
$('nav#u tabs li:eq(2)a')。tab('show');
警报(2);
}
});
何时以及如何调用activate_tab()
?@JustinY在测试模式下,只需点击一个锚。当你说,activate\u Tab()
不起作用时,你是什么意思?当它被调用时会发生什么?显示选项卡2时,是否确保选项卡1和选项卡3被隐藏?是否将active_tab()
放在jquery wrap中,即jquery(函数($){})代码>@JustinY(我编辑了上面的激活选项卡())警报“1”触发,警报“2”不触发。我是否需要调用隐藏其他选项卡的函数?我已经添加了此项,在单击相应的定位点后,我不会收到警报“1”。
<script>jQuery(function($){$('#nav_tabs li:eq(2) a').tab('show');})</script>
function activate_tab(){
//process other data...then goto tab
alert(1);
$('#nav_tabs li:eq(2) a').tab('show');
alert(2);
}
<script>
jQuery(function($){
function activate_tab(){
//process other data...then goto tab
alert(1);
$('#nav_tabs li:eq(2) a').tab('show');
alert(2);
}
});
</script>