Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/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
Jquery ui jquery ui选项卡选择方法不工作_Jquery Ui_Jquery_Jquery Ui Tabs - Fatal编程技术网

Jquery ui jquery ui选项卡选择方法不工作

Jquery ui jquery ui选项卡选择方法不工作,jquery-ui,jquery,jquery-ui-tabs,Jquery Ui,Jquery,Jquery Ui Tabs,我有两个选项卡,每个选项卡上都有一个提交按钮。单击按钮时,我需要重新加载该特定选项卡的内容,以从服务器获取更新的数据 if (validStatus()) { $.ajax({ //... success: reloadTab }); } function reloadTab() { var currentTab = $("#tabs").tabs("option", "active

我有两个选项卡,每个选项卡上都有一个提交按钮。单击按钮时,我需要重新加载该特定选项卡的内容,以从服务器获取更新的数据

if (validStatus()) {
    $.ajax({
        //...
        success: reloadTab
    });
}    

function reloadTab() {                
            var currentTab = $("#tabs").tabs("option", "active");
            alert(currentTab);
            $('#tabs').tabs('select', currentTab);
            alert(currentTab);
        }
单击按钮时,选项卡不会刷新。我看到了第一个警报,但没有看到第二个警报

HTML格式如下:

负责人:

<link rel="stylesheet" href="@this.Url.Content("//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css")" />
<script>
    $(function () {
        $("#tabs").tabs();
    });
</script>
正文:


您在浏览器的控制台中看到了什么吗?你用的是什么浏览器? 请尝试此操作以帮助您进行调试

function reloadTab() {    

console.log($('#tabs')); // if this is an empty object, the element doesn't exist when you call this function
console.log($('#tabs').tabs()); // if this doesn't return 'function', you haven't included a library properly, maybe jquery ui, or jquery, or you're using an old version or something
console.log(currentTab); // if this is undefined then something went wrong and no tab is active            
        var currentTab = $("#tabs").tabs("option", "active");
        alert(currentTab);
        $('#tabs').tabs('select', currentTab);
        alert(currentTab);
    }

您在浏览器的控制台中看到了什么吗?你用的是什么浏览器? 请尝试此操作以帮助您进行调试

function reloadTab() {    

console.log($('#tabs')); // if this is an empty object, the element doesn't exist when you call this function
console.log($('#tabs').tabs()); // if this doesn't return 'function', you haven't included a library properly, maybe jquery ui, or jquery, or you're using an old version or something
console.log(currentTab); // if this is undefined then something went wrong and no tab is active            
        var currentTab = $("#tabs").tabs("option", "active");
        alert(currentTab);
        $('#tabs').tabs('select', currentTab);
        alert(currentTab);
    }

显示“选择”选项卡。。。已弃用,使用“选项”、“活动”选项卡,索引修复了我的问题。在这条评论中找到了解决方案:

变成了“选择”选项卡。。。已弃用,使用“选项”、“活动”选项卡,索引修复了我的问题。在这个评论中找到了解决方案:

Firebug给了我这个错误:没有为tabs小部件实例“选择”这样的方法。这是一个版本问题吗?Firebug给了我这个错误:没有为tabs小部件实例“选择”这样的方法。这是一个版本问题吗?对我来说正好相反!我在一个相当旧的应用程序中工作,正在努力使用active选项。刚刚切换到好的老选择。谢谢!你给我暗示!对于我的工作,使用$tabs.tabs{active:index};对我来说,正好相反!我在一个相当旧的应用程序中工作,正在努力使用active选项。刚刚切换到好的老选择。谢谢!你给我暗示!对于我的工作,使用$tabs.tabs{active:index};