user402131
user402131

Reputation: 23

Get tab selected Id in jQuery UI 1.9

How can I get the tab selected Id in jQuery UI 1.9?

I use this method in jQuery UI 1.8 :

var key = $('#chart-report-tabs .ui-tabs-panel:not(.ui-tabs-hide)').prop('id');

but it does not work in the 1.9 version.

Upvotes: 0

Views: 4129

Answers (5)

krunal chavda
krunal chavda

Reputation: 1

$('#divName .ui-tabs-panel[aria-hidden="false"]').prop('id');

Upvotes: -2

billyonecan
billyonecan

Reputation: 20250

Use the activate or beforeActivate events with ui.newPanel:

$('#chart-report-tabs').tabs({
  activate: function(e, ui) {
    var key = $(ui.newPanel).prop('id');
  }
});

Check the documentation

Upvotes: 0

webdeveloper
webdeveloper

Reputation: 17288

Try this:

var $tabs = $('#chart-report-tabs');
var index = $tabs.tabs('option', 'selected');
var key = $tabs.tabs("option", "panel").find('.ui-tabs-panel').eq(index).prop('id');

Source: jQuery UI Tabs selected index

Upvotes: 0

david9
david9

Reputation: 169

Try this one:

$("#<id of tabs>").tabs("option","active")

Returns zero-based index of active tab

Upvotes: 2

light
light

Reputation: 421

Try this:

$('#chart-report-tabs .ui-tabs-panel[aria-hidden="false"]').prop('id');

Upvotes: 3

Related Questions