[英]get the tab text on select jquery ui tabs
I m using jquery ui tabs 我正在使用jquery ui标签
I can get the index of the selected tab on "load" (ajax) event 我可以在“load”(ajax)事件中获取所选选项卡的索引
$('#tabs').tabs(
{
load: function(e, ui) {
if($('#tabs').tabs('option','selected') == 0) { }
}
});
Now i want to get the tab name 现在我想获得标签名称
for eg... 例如......
<ul>
<li><a href="newprofile.jsp"><span>Profile</span></a></li>
<li><a href="ashout.jsp" id="friends"><span>Shouts</span></a></li>
</ul>
I want to retrieve the text Profile when first tab is clicked or Shout when second tab is clicked. 我想在单击第一个选项卡时检索文本配置文件,或在单击第二个选项卡时检索Shout。
Thanks 谢谢
You can use the ui
argument passed in, specifically ui.tab
to get the anchor element, like this: 您可以使用传入的
ui
参数 ,特别是ui.tab
来获取锚元素,如下所示:
var text = $(ui.tab).text();
I don't have your pages to load, but you can test a demo here using the select
event , it works the same way. 我没有加载您的页面, 但您可以使用
select
事件在此测试演示 ,它的工作方式相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.