【问题标题】:I would like to prevent removing a jquery ui tab我想防止删除 jquery ui 选项卡
【发布时间】:2012-09-24 01:26:49
【问题描述】:

正如标题中所说,我想防止删除 jquery ui 选项卡或至少在之前要求确认。

我试过了

$( "#tabs" ).bind( "tabsremove", function(event, ui) {
        var ok=confirm("Are you sure you want to close this tab ?");
        if (ok) {
            return true;
        } else {
            return false;
        };
     });

$( "#tabs" ).bind( "tabsremove", function(event, ui) {
        var ok=confirm("Are you sure you want to close this tab ?");
        if (ok) {
            return true;
        } else {
            return false;
        };
     });

但问题是在之后提出的,而不是在我想要的之前提出的。 这可能吗?

【问题讨论】:

  • 您是否要删除确认提示?抱歉,我无法真正理解您在问题中的意思,所以我想问您...
  • 不,我想先问这个问题,所以如果答案是“否”,则不会删除标签,如果是,则会删除。
  • 我不太清楚,但是您要使用 OnLoad 还是 OnClick?
  • 点击 ui-icon-circle-close

标签: jquery-ui-tabs


【解决方案1】:

这是what you mean?

$( "#tabs span.ui-icon-close" ).live( "click", function() {
        var ok=confirm("Are you sure you want to close this tab ?");
        if (ok) {
            var index = $( "li", $tabs ).index( $( this ).parent() );
            $tabs.tabs( "remove", index );
        } else {
            return false;
        };

这是来自jQuery-ui-tabs

【讨论】:

  • 你应该把它放在你的$(document).ready(function(){//put code here}) 如果你想给我们更多的代码,那就太好了。什么不工作?试过chrome开发者工具调试吗?
  • 感谢我使用 chrome,我看到我有 ui-icon-circle-close 而不是 ui-icon-close 这里 [link]test03.christophe-charron.org/jquery/menu_00.php 点击 treeview "commandes" 添加选项卡
猜你喜欢
  • 1970-01-01
  • 2012-07-27
  • 1970-01-01
  • 2012-02-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多