jQuery UI +选项卡:如何知道如何获得带有标签的选项卡 [英] JQuery UI + tabs : How to kow to get the selected tab with imbricated tabs
问题描述
我是Jquery的新手.
我正在使用JQuery UI,并且已嵌入Tabs:选项卡中的选项卡.
___________
标签1 |标签2 |标签3 |标签4 |标签5
_____________
标签1-1 |标签1-2 |标签1-3 |标签1-4 |标签1-5
I'm new to Jquery.
I'm using JQuery UI and i have imbricated Tabs : Tabs in tabs.
___________
tab 1 | tab 2 | tab 3 | tab 4| tab 5
_____________
tab 1-1 | tab 1-2 | tab 1-3 | tab 1-4| tab 1-5
我正在使用$('#div').bind('tabsselect',function(event,ui){
I'm using $('#div').bind('tabsselect', function(event, ui) {
selectedTab = ui.index;
alert('selectedTab:'+ selectedTab);
});
selectedTab = ui.index;
alert('selectedTab : ' + selectedTab);
});
了解所选索引.
如果我单击选项卡" 1,则返回的所选索引是正确的.
to kown the selected index.
If i click on "tab "1 the selected index returned is correct.
但是,当单击第二级中的选项卡(选项卡1-xx")时,也会触发该事件.我想在选项卡(tab x)的第一级上重新绑定bind('tabsselect',function(event,ui).
我该怎么办?
But when click on tabs in the second level ("tab 1-xx") the event is fired too. I want to resctriced the bind('tabsselect', function(event, ui) on the first level of tab (tab x).
How can i do that ?
谢谢
推荐答案
您可以发布选项卡的代码吗?
Could you post the code of the tabs?
我认为问题是因为您在"#div"中定义了子代. 因此,jQuery触发了将选项卡1-x的标签选择为其父标签的事件
I supose the problem is because inside the "#div" you have defined the children. So jquery trigger the event of tag select of tab 1-x to its parent
也许您可以尝试为每个孩子取消绑定该事件.
maybe you could try to unbind the event for each of the children.
这篇关于jQuery UI +选项卡:如何知道如何获得带有标签的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!