简体   繁体   English

jQuery UI标签激活事件未触发

[英]jquery ui tabs activate event not firing

All, 所有,

I am having trouble getting a handler to run when a new JQuery tab pane is shown. 显示新的“ JQuery”选项卡窗格时,我无法让处理程序运行。 I am using JQuery 1.6.3 and JQuery-ui 1.8.16. 我正在使用JQuery 1.6.3和JQuery-ui 1.8.16。 My HTML looks like this: 我的HTML看起来像这样:

<div class="tabs">
    <ul>
        <li>
            <a href="#one">one</a>
        </li>
        <li>
            <a href="#two">two</a>
        </li>
    </ul>
    <div id="one">one</div>
    <div id="two">two</div>
</div>

My JavaScript looks like this: 我的JavaScript看起来像这样:

    $(".tabs").tabs({
        select  : function(event,ui) {
            alert("selected a tab");
        },
        activate : function(event,ui) {
            alert("activated a tab");
        }
    });

When I click on a tab, the select event fires (I see the alert box) but the activate event doesn't fire (I don't see the alert box). 当我单击一个选项卡时,将触发select事件(我看到警报框),但不会触发Activate事件(我没有看到警报框)。 I don't understand what's wrong. 我不明白怎么了

My goal is to run some code on the various widgets that appear within each tab pane when they are opened. 我的目标是在打开每个选项卡窗格中显示的各种小部件上运行一些代码。 I would be fine with associating that code with the select event, but that event fires before the widgets complete rendering. 我可以将代码与select事件关联起来,但是在小部件完成渲染之前触发该事件。

How can I run code after the widgets in the tab pane have all been rendered? 标签窗格中的小部件全部呈现 ,如何运行代码?

Thanks. 谢谢。

JQueryui 1.8 only supports select event for tabs. JQueryui 1.8仅支持选项卡的select事件。 here is the link 链接在这里

starting from JQueryui 1.9 and above removed select event. 从JQueryui 1.9及更高版本开始,已删除选择事件。 instead introduced activate event for tabs. 而是为标签引入了激活事件。 here is the link 链接在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM