【问题标题】:Simplemodal : Destroy data after closingSimplemodal : 关闭后销毁数据
【发布时间】:2014-02-14 11:04:20
【问题描述】:

我对 Simplemodal 有点卡住了。

我想在关闭模态窗口后销毁具有 $('p.confirm') 类的数据。

这是我到目前为止所拥有的,但它不起作用:

if (document.getElementsByClassName('confirm').length > 0){

    $('p.confirm').modal({
        overlayClose:true,
        onClose:function(dialog){
            dialog.data.find('.confirm').remove();

            $.modal.close(); // must call this!
        },
        persist:true

    });

    }

谁能帮帮我?谢谢

【问题讨论】:

  • 关闭后是否要删除p.confirm?
  • 是的,我想删除它
  • 如果您搜索的内容请告诉我jsfiddle.net/3RV8C/5
  • 谢谢克里斯,这正是我想要实现的。我不知道首先必须在我的函数中调用 $.modal.close()

标签: simplemodal


【解决方案1】:
<p class="confirm">asdf</p>

if (document.getElementsByClassName('confirm').length > 0){

    $('p.confirm').modal({
        overlayClose: true,
        onClose: function(dialog){

            $.modal.close(); // must call this!
            dialog.data[0].remove();


        },
        persist:true

    });
}

【讨论】:

    猜你喜欢
    • 2012-08-13
    • 1970-01-01
    • 2017-05-01
    • 1970-01-01
    • 2013-12-02
    • 1970-01-01
    • 2014-08-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多