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 event...but it's not) of the currently selected tab? I'd prefer not to use the index because ordering of the tabs might change. I prefer not to use the style markups as those may change in future releases. Is there a method for this? If not, can I somehow use the index to access this (maybe even by accessing the panel object first)? Any other ideas?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
After JQuery 1.9 selected is deprecated
So use
var active = $( "#jtabs" ).tabs( "option", "active" );
For jQuery UI >= 1.9 you can use
ui.newPanel.selector
:If you want the
id
(or actually thehref
) from the selected tab, you can useeq()
to retrieve the jQuery Object.You can see an example here: http://jsfiddle.net/svierkant/hpU3T/1/
For jquery version below 1.9:
And you can find the active tab using:
This works: