使用jQuery重命名jQuery UI选项卡 [英] Rename jQuery UI tab with jQuery

查看:155
本文介绍了使用jQuery重命名jQuery UI选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个标签:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Tab1</a></li>
        <li><a href="#tabs-2">Tab2</a></li>
        <li><a href="#tabs-3">Tab3</a></li>
    </ul>
    <div id="tabs-1"></div>
    <div id="tabs-2"></div>
    <div id="tabs-3"></div>
</div>

使用此jQuery

<script type="text/javascript">
    $(document).ready(function () {
        var $tabs = $("#tabs").tabs({
            select: function (e, ui) {
            }
        });
    });
</script>

我想在第一个和第三个选项卡上进行某些操作时,第二个选项卡的标签将名称从"Tab2"更改为其他文本"

I'd like when I do some operation on the first and the third tab, the label of second tab change the name from "Tab2" to "Other text"

我尝试了几种在Google上找到的方法,但没有任何用处.

I tried several way found on Google but any work.

谢谢

推荐答案

您只需运行以下代码,它将更改第二个选项卡链接的文本.

You could just run the following code and it will change the text for the second tab link.

$('#tabs ul:first li:eq(1) a').text("Other text");

示例(单击第三个标签中的按钮)

Example (click button in 3rd tab)

这篇关于使用jQuery重命名jQuery UI选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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