【问题标题】:jQuery Dirtyforms - Is it possible to use the native browser confirm() as dialog?jQuery Dirtyforms - 是否可以使用本机浏览器确认()作为对话框?
【发布时间】:2012-10-02 05:51:29
【问题描述】:

site 中的示例通常假设使用了 jquery 对话框,例如 facebox 或 jquery-ui。是否可以使用本机浏览器确认()作为对话框?如果是这样,有没有办法绑定确定和取消按钮?

【问题讨论】:

    标签: jquery jquery-dirtyforms


    【解决方案1】:

    我不知道这有多优雅,但我通过这样做解决了它:

    $('form').dirtyForms();
    $.DirtyForms.debug = true;
    $.DirtyForms.dialog = {
        fire: function (message, title) {
            $.DirtyForms.choiceContinue = confirm(message);
        },
        bind: function () {
            $.DirtyForms.choiceCommit($.Event("click"));
        },
        refire: function (content) {
            return false;
        },
        stash: function () {
            return false;
        }
    };
    

    【讨论】:

      【解决方案2】:

      根据the documentation,使用浏览器对话框的正确解决方案是将对话框设置为false

      $('form').dirtyForms();
      $.DirtyForms.dialog = false;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-12-14
        • 1970-01-01
        • 2012-11-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-05-24
        相关资源
        最近更新 更多