Jim
Jim

Reputation: 211

jquery-ui 1.10.2 tabs selecting

Using jquery-ui 1.10.2, I am unable to select a tab as usual. I am using $('.selector').tabs('select', '.selector'); as with earlier versions of jquery-ui.

What is the replacement for this functionality in the latest version of jquery-ui.

I have created a jsFiddle test here. (http://jsfiddle.net/jgergen/5RMaN/37/).

Thank you, Jim

Upvotes: 0

Views: 497

Answers (2)

PSL
PSL

Reputation: 123739

Move $('#tSheet').tabs(); to the bottom after appending the elements.

$('#tSheet ul').append('<li><a href="#page-1">One</a></li>');
$('#tSheet ul').append('<li><a href="#page-2">Two</a></li>');
$('#tSheet ul').append('<li><a href="#page-3">Three</a></li>');

$('#tSheet').append('<div id="page-1">Page One Text</div>');
$('#tSheet').append('<div id="page-2">Page Two Text</div>');
$('#tSheet').append('<div id="page-3">Page Three Text</div>');
$('#tSheet').tabs();

Fiddle

For dynamic tabs use this syntax $('#tSheet').tabs("option", "active", 2);

Upvotes: 1

Jim
Jim

Reputation: 211

For the latest version of jquery-ui - 'select' is not longer available. To select a tab, you must use the options. The following code will select a tab.

// tabs are 0 based indexed
$('#tSheet').tabs('options', 'active', 1);
// will select the second tab.

Still have not found a way to get the tab index without a lot of DOM navigation. it would be nice to have something like this: $('#tSheet').tabs('find', '.selector');

Thank you all for your help. Jim

Upvotes: 0

Related Questions