开发者

jQueryUI Tab - Selected TabText on demand

开发者 https://www.devze.com 2023-01-31 01:22 出处:网络
I need a function which will get the text of the currently selected tab. I can get the selected tab using events, but I need to get the text even if the selected event is not yet thrown.

I need a function which will get the text of the currently selected tab. I can get the selected tab using events, but I need to get the text even if the selected event is not yet thrown.

Here's my event script,

    $( "#开发者_Go百科tabs" ).bind( "tabsselect", function(event, ui) {
         _textOfTab=$(ui.tab).text();
     });

How can I just query the tabs for the currently selected one?


The <li> of the selected tab will have a ui-tabs-selected class on it, you can use that to find the active tab.

$("#tabs ul.ui-tabs-nav li.ui-tabs-selected").text()

You can test it out here.

0

精彩评论

暂无评论...
验证码 换一张
取 消