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");});

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

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