在添加另一个 JQueryUI 选项卡之前需要删除一个 JQueryUI 选项卡
我有一个 jquery ui 问题,如下所示:
$("a[rel=#edit]").live("click", function(e) {
var $tabs = $('#tabs').tabs();
var selected = $tabs.tabs('option', 'selected');//gives the currently selected tab
var tablength = $tabs.tabs('length');//gives the tab length
alert('tab length : '+tablength);
// need to remove any edit page tabs if open as only one edit page need to be open.
$("#tabs").tabs("add",$(this).attr('href'),"Edit");
return false;
});
这段代码的作用是,当我单击编辑链接时,它会向当前的选项卡集添加一个新选项卡。新页面是一个编辑页面,标题为“编辑”。
我希望每当我单击 edit 时,如果我之前单击编辑链接而打开了任何编辑页面,则该页面应该被关闭。
现在,我一直在尝试获取各个选项卡属性来检查标题是否为 Edit ,但一直无法做到这一点。任何有关如何删除现有编辑页面选项卡的帮助都会非常有帮助。
I have a jquery ui problem which is as follows:
$("a[rel=#edit]").live("click", function(e) {
var $tabs = $('#tabs').tabs();
var selected = $tabs.tabs('option', 'selected');//gives the currently selected tab
var tablength = $tabs.tabs('length');//gives the tab length
alert('tab length : '+tablength);
// need to remove any edit page tabs if open as only one edit page need to be open.
$("#tabs").tabs("add",$(this).attr('href'),"Edit");
return false;
});
What this code does is it add a new tab to the current set of tabs, when I click a edit link. The new page is an edit page with title Edit.
I want it to be that whenever I click on edit , if there is any opened edit page from my earlier clicks on the edit link, it sould be closed.
Now, I have been trying to get individual tab properties to check if the title is Edit , but haven't been able to do so. Any help on how to remove the existing edit page tabs would be greatly helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试这个选择器,
即删除“选项卡”div 中标题为“编辑”的列表项。
You can try this selector
I.e. remove the list item with title "Edit" in the "tabs" div.
如果您需要删除一个选项卡并知道该选项卡的索引,您所要做的就是..
If you need to remove a tab and know the index of the tab, all you have to do is..