views:

335

answers:

3

I set up some jQuery tabs to start off with no tabs selected like this:

$('#tabs').tabs( { selected: -1 } );

Then I also have a separate link that when pressed needs to deselect all the tabs.

$("#deselectButton").click(function(){   
    $('#tabs').tabs( 'select' , -1 )
});

or

$("#deselectButton").click(function(){   
    $('#tabs').tabs( 'selected' , -1 )
});

The deselectButton click does deselect the tabs content, however the tabs title remains active with the class 'ui-tabs-selected ui-state-active'.

What is the correct way to deselect all the tabs?

A: 

Try this code:

$("#deselectButton").click(function(){          
    $('#tabs').tabs( 'selected' , -1 )
    $(".ui-tabs-selected").removeClass("ui-state-active").removeClass("ui-tabs-selected");
});
Click Upvote
Yes that did it, thank you $(".ui-tabs-selected").removeClass("ui-state-active").removeClass("ui-tabs-selected").addClass("ui-state-default");
Julian
A: 

It works perfectly, thanks a lot :D

Scade
A: 

thanks ... that helped me 2 :D

flv