获取选择jquery ui选项卡上的选项卡文本 [英] get the tab text on select jquery ui tabs

查看:224
本文介绍了获取选择jquery ui选项卡上的选项卡文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery ui tabs

I m using jquery ui tabs

我可以在load(ajax)事件中获取所选标签的索引

I can get the index of the selected tab on "load" (ajax) event

$('#tabs').tabs(
      {
        load: function(e, ui) {
            if($('#tabs').tabs('option','selected') == 0) { }
      }
       });

现在我想获得标签名称

例如......

<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.

谢谢

推荐答案

您可以使用 ui 参数,特别是 ui.tab 获取锚元素,如下所示:

You can use the ui argument passed in, specifically ui.tab to get the anchor element, like this:

var text = $(ui.tab).text();

我没有要加载的页面,但您可以使用 select 事件在这里测试一个演示,它的工作方式相同。

I don't have your pages to load, but you can test a demo here using the select event, it works the same way.

这篇关于获取选择jquery ui选项卡上的选项卡文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆