I know I can get the index of the currently selected tab but can I somehow get to the ID (the equivalent of the ui.panel.id
if this were triggered by an tab eve
For jQuery UI >= 1.9 you can use ui.newPanel.selector
:
$('#tabs').on('tabactivate', function(event, ui) {
console.log(ui.newPanel.selector);
});
After JQuery 1.9 selected is deprecated
So use
var active = $( "#jtabs" ).tabs( "option", "active" );
If you want the id
(or actually the href
) from the selected tab, you can use eq()
to retrieve the jQuery Object.
You can see an example here: http://jsfiddle.net/svierkant/hpU3T/1/
This works:
$('#divName .ui-tabs-panel[aria-hidden="false"]').prop('id');
For jquery version below 1.9:
<div class="roundedFloatmenu">
<ul id="unid">
<li class="titleHover" id="li_search">Search</li>
<li class="titleHover" id="li_notes">Notes</li>
<li class="titleHover active" id="li_writeback">Writeback</li>
<li class="titleHover" id="li_attorney">Attorney</li>
</ul>
</div
And you can find the active tab using:
jQuery('#unid').find('li.active').attr('id')
$("#tabs .ui-state-active a").attr("id");