gpt4 book ai didi

jquery - 如果在 init 中选择了默认选项卡,则不会触发 tabselect 事件处理程序

转载 作者:行者123 更新时间:2023-12-01 01:51:49 25 4
gpt4 key购买 nike

我正在使用 jquery ui 选项卡并尝试在初始化时将“选定”选项卡设置为 0,但它不会触发 tabselect 事件。如果我将“选定”选项卡设置为 1 或任何其他选项卡,则 tabselect 事件将触发。我的想法是,由于 0 索引选项卡是默认设置,因此将“选定”选项卡设置为默认值不会触发 tabselect 事件,因为它已经被选中。我这样想对吗?并且,有没有办法在 ui-tabs 实用程序的上下文中使其工作?

divRelationships.tabs({
select: function (e, ui) {
createRelationshipListBoxForWebObject(divRelationships, webObjectGuid, ui);
}
});
divRelationships.tabs("select", 0);

最佳答案

您可以根据您的需要使用 showcreate 事件(show 似乎更接近您想要的)。每当显示“Tab 0”时(包括在选项卡小部件初始化时)都会调用 show

考虑到这一点,您就不必手动触发 select 事件。以下内容就足够了:

divRelationships.tabs({
show: function (e, ui) {
createRelationshipListBoxForWebObject(divRelationships, webObjectGuid, ui);
}
});

// Show will automatically be called when the tabs widget is created.

关于jquery - 如果在 init 中选择了默认选项卡,则不会触发 tabselect 事件处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8096868/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com