jQuery UI tab selection method doesn't work


Zach

I have two tabs, each with a submit button. After the button is clicked, I need to reload the content of that particular tab to get the updated data from the server.

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

function reloadTab() {                
            var currentTab = $("#tabs").tabs("option", "active");
            alert(currentTab);
            $('#tabs').tabs('select', currentTab);
            alert(currentTab);
        }

When the button is clicked, the tabs do not refresh. I see the first alert but not the second.

HTML is as follows:

head:

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

body:

<div id="tabs">
<ul>
    <li><a href="#Tab1" title="Tab1">The first tab</a></li>
    <li><a href="#Tab2" title="Tab2">the second tab</a></li>
    <li><a href="#Success" title="Success">Success</a></li>
</ul>

<div id="Success">
    testing
</div>

<div id="Tab1">

    <fieldset >
        <legend>Overview</legend>
        <input type="button" id="submit1" value="submit" />
        <br />
    </fieldset>

    <fieldset style="width: 700px;">
        <legend>Overview</legend>
        <div>
            <table >
            //updated with ajax
            </table>
        </div>
    </fieldset>

    <script>
        //reloadTab is in here
    </script>
</div>

<div id="Tab2">

    <fieldset style="float:left; width:300px;">
        <input id="submit2" type="button" value="submit"/>
    </fieldset>

    <fieldset style="float:left;">
        <legend>Overview</legend>
        <table>
        //updated with ajax
        </table>
    </fieldset>

    <script>.....</script>
</div>

Zach

Originally tabs.('select', ...)deprecated, tabs.('option', 'active', index)fixed my issue. Solution found in this comment : https://stackoverflow.com/a/16033969/1463649

Related


jQuery UI tab selection method doesn't work

Zach I have two tabs, each with a submit button. After the button is clicked, I need to reload the content of that particular tab to get the updated data from the server. if (validStatus()) { $.ajax({ //... success: reloadTab }); }

jQuery UI tab beforeLoad preventDefault doesn't work

Judge God Somehow the e.preventDefault()on beforeLoad()event in jQuery UI Tabs is not working properly. Here is a small example: <div id="tabs"> <ul> <li><a href="#exampleExistingTab">Existing Tab</a></li> <li><a href="/path/to/remote/tab">

jQuery UI tab beforeLoad preventDefault doesn't work

Judge God The e.preventDefault()on beforeLoad()event in jQuery UI Tabs is not working properly. Here is a small example: <div id="tabs"> <ul> <li><a href="#exampleExistingTab">Existing Tab</a></li> <li><a href="/path/to/remote/tab">Remote T

jQuery UI tab beforeLoad preventDefault doesn't work

Judge God Somehow the e.preventDefault()on beforeLoad()event in jQuery UI Tabs is not working properly. Here is a small example: <div id="tabs"> <ul> <li><a href="#exampleExistingTab">Existing Tab</a></li> <li><a href="/path/to/remote/tab">

Selection sort method doesn't work?

Shuryu Kisuke Recently I wrote a java program that performs a selection sort on an array, however, it doesn't seem to return the correct output. What am I doing wrong? Desired output: [2.0, 3.7, 6.2, 7.4, 8.1, 8.5, 9.9, 15.7] Actual output: [7.4, 2.0, 3.7, 6.2

Time selection doesn't work in jQuery

tent I have the zip code below. I have attached the html code for the table body ( tbl_body) . There are time to select fields such as fe_dateand fs_date. But the time selection window will not be displayed. please help me. $.post("<?php echo base_url('control

Time selection doesn't work in jQuery

tent I have the zip code below. I have attached the html code for the table body ( tbl_body) . There are time to select fields such as fe_dateand fs_date. But the time selection window will not be displayed. please help me. $.post("<?php echo base_url('control

Time selection doesn't work in jQuery

tent I have the zip code below. I have attached the html code for the table body ( tbl_body) . There are time to select fields such as fe_dateand fs_date. But the time selection window will not be displayed. please help me. $.post("<?php echo base_url('control

Time selection doesn't work in jQuery

tent I have the zip code below. I have attached the html code for the table body ( tbl_body) . There are time to select fields such as fe_dateand fs_date. But the time selection window will not be displayed. Please help me. $.post("<?php echo base_url('control

Time selection doesn't work in jQuery

tent I have the zip code below. I have attached the html code for the table body ( tbl_body) . There are time to select fields such as fe_dateand fs_date. But the time selection window will not be displayed. Please help me. $.post("<?php echo base_url('control

Time selection doesn't work in jQuery

tent I have the zip code below. I have attached the html code for the table body ( tbl_body) . There are time to select fields such as fe_dateand fs_date. But the time selection window will not be displayed. Please help me. $.post("<?php echo base_url('control

jQuery .on() method doesn't work

Java_User violin Please take a look at the fiddle above. of . The pair method doesn't seem to work. I'm sure I must be missing something obvious. JS var rand; $('button').click(function(){ rand = Math.floor((Math.random() * 100) + 1); $('#maindiv').app

jQuery .on() method doesn't work

Java_User violin Please take a look at the fiddle above. of . The pair method doesn't seem to work. I'm sure I must be missing something obvious. JS var rand; $('button').click(function(){ rand = Math.floor((Math.random() * 100) + 1); $('#maindiv').app

SwiftUI tab selection doesn't work with any hashable content

Richard Witherspoon SwiftUI's Tab option should work with anything hashable, but it doesn't seem to work. In the example provided, you can see that in the Jobs tab, if you use an integer as the tab selection, the broadcast works fine. When you switch to the Br

SwiftUI tab selection doesn't work with any hashable content

Richard Witherspoon SwiftUI's Tab option should work with anything hashable, but it doesn't seem to work. In the example provided, you can see that in the Jobs tab, if you use an integer as the tab selection, the broadcast works fine. When you switch to the Br

SwiftUI tab selection doesn't work with any hashable content

Richard Witherspoon SwiftUI's Tab option should work with anything hashable, but it doesn't seem to work. In the example provided, you can see that in the Jobs tab, if you use an integer as the tab selection, the broadcast works fine. When you switch to the Br

SwiftUI tab selection doesn't work with any hashable content

Richard Witherspoon SwiftUI's Tab option should work with anything hashable, but it doesn't seem to work. In the example provided, you can see that in the Jobs tab, if you use an integer as the tab selection, the broadcast works fine. When you switch to the Br

SwiftUI tab selection doesn't work with any hashable content

Richard Witherspoon SwiftUI's Tab option should work with anything hashable, but it doesn't seem to work. In the example provided, you can see that in the Jobs tab, if you use an integer as the tab selection, the broadcast works fine. When you switch to the Br

jQuery UI Selectmenu doesn't work in dialog

gap Selection will not open when inside a table inside a dialog. I included the code snippet from the question $('select').selectmenu(); $('.RegularDialog').dialog({ autoOpen: false, modal: true, height: 500, width: 570 }); $('#OpenDialog').click(funct

Tablesorter in dynamic JQuery UI doesn't work

GwydionFR This is my first post on this site and I swear I've searched for the answer to my question. Maybe I missed something about the topic I read. (Sorry for my English, I'm French.) I create a dialog when user executes clic and then populate this dialog w

Localization doesn't work in jQuery UI datePicker

usr-local-ΕΨΗΕΛΩΝ I have made some modifications to the UI of a web application that I want to maintain. These include getting JS libraries from NuGet and aligning them with previous versions. Older versions running jQuery 1.8.2 and jQuery UI 1.8.24 (customize

jQuery UI Selectmenu doesn't work in dialog

gap Selection will not open when inside a table inside a dialog. I included the code snippet from the question $('select').selectmenu(); $('.RegularDialog').dialog({ autoOpen: false, modal: true, height: 500, width: 570 }); $('#OpenDialog').click(funct

jQuery UI doesn't work with MFC HTMLDialog?

Muhammad Raza This code works perfectly with asp.net c#. I am using this code but can't get the mfc htmldialog to work. The error is that the object does not support properties or methods tabs. <HEAD> <title></title> <link href="jquery-ui-1.8

jQuery UI Selectmenu doesn't work in dialog

gap Selection will not open when inside a table inside a dialog. I included the code snippet from the question $('select').selectmenu(); $('.RegularDialog').dialog({ autoOpen: false, modal: true, height: 500, width: 570 }); $('#OpenDialog').click(funct

jQuery UI autocomplete doesn't work for me

Raphael Monin I need jQuery autocomplete for a project, but it doesn't work for me. I don't know where is my mistake. Thanks in advance! <!DOCTYPE html> <html> <head> <meta charset="iso-8859-1" /> <title>Votre titre</title> <link rel="stylesheet"

jQuery custom UI dialog doesn't work

Jamie R. I'm creating a small web page based on the periodic table of elements, and I'm trying to make it so that if I click on the square of the element, a dialog will pop up with a list of compounds. I'm having a problem showing a jQuery dialog with a custom

DatePicker jQuery UI doesn't work

DQ_happy I'm trying to build my personal website using express and want to put a date picker on one of the pages. I tried to change the ejs file for this page, but nothing worked. I'm wondering if it's because the layout.ejs file exists, and wondering how to l

jQuery ui resizable() doesn't work

Marek link to jsFiddle HTML <div class="empty ui-widget-content"> <div class="settings-menu"> </div> </div> CSS .empty { height: 50px; display: block; float: left; position: relative; margin: 6px 0; width: 100%; background:

JavaScript doesn't work with jQuery UI

Madhav Narayan I'm having trouble trying to get simple javascript that works with jQuery UI. I'm using jQuery UI to provide autocomplete for a set of form input elements, and this works satisfactorily, but none of the JavaScript code I've written works. Strang