views:

19

answers:

1

Hi,

I want to set the css of one tab navigation button programmaticaly. The index of the tab should be a variable.

Use case: Setting a button to color red when it content has changed ascync.

Thanks!!

A: 

Give your tab divs ids as tab-0, tab-1, tab-2, etc; the following should work -

var $tabs = $('#example').tabs();
var selected = $tabs.tabs('option', 'selected'); // retrieve here or pass it to function.

$("#tab-" + selected ).addClass('myClass');
Ankit Jain
Thanx, but that would apply style to the content div. I want to apply style to one navigation button only.
artte
then as the tab example says.. you need to put style to `UL` and `LI` ( .ui-tabs .ui-tabs-hide ) as mentioned in official example http://jqueryui.com/demos/tabs/
Ankit Jain