Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从另一个函数中调用twitter引导选项卡函数_Javascript_Jquery_Twitter Bootstrap - Fatal编程技术网

Javascript 从另一个函数中调用twitter引导选项卡函数

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

使用bootstrap-tab.js,我想激活一个选项卡,从另一个函数中调用它。 Html:

我不熟悉javascript/jQuery

[编辑]我将原来的页面精简到上面所示的内容,效果良好。因此,可能与其他功能发生冲突。很抱歉浪费了你的时间。

如果你不想试试这个

    <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>