December 29, 2011

How to deselect tabs in jquery

Question by sasirekha

$(document).ready(function() {
    $('#tabs > ul').tabs('select', 1);
    $('#tabs').tabs({
        selected: 1
    });
    $("#tabs").tabs({
        disabled: [0, 2, 3]
    });
    return false;
});

To move to another tab, CSS style is not followed. How do I deselect the current tab?

Answer by Starx

Use the following to select a different tab or move to another tab.

$( "#tabs" ).tabs( "option", "selected", 2 );

However, to deselect the current tab, you have to select another tab, that’s the only way the tabs work. If you want to clear the style of current selected tabs then use

$("#tabs .ui-tabs-selected").removeClass("ui-state-active").removeClass("ui-tabs-selected");});
...

Please fill the form - I will response as fast as I can!