Get tab selected Id in jQuery UI 1.9

萝らか妹 提交于 2019-12-12 05:28:47

问题


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.


回答1:


Try this:

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



回答2:


Try this one:

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

Returns zero-based index of active tab




回答3:


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




回答4:


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




回答5:


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


来源:https://stackoverflow.com/questions/13229139/get-tab-selected-id-in-jquery-ui-1-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!