0

我的代码中有几个表单,我想在提交之前分配一个确认框来显示。

因此,我使用 Boxy Jquery,但是在用户确认后,$(this).submit()它不起作用。这是因为有不止一种形式吗?

这是我的 JS:

$("form").submit(function(ev) {
        Boxy.confirm("Are you sure?", function() { $(this).submit(); }, {title: 'Confirm'});
        return false;

});
4

2 回答 2

0
   $("form").submit(function(ev) {
        var $this = jQuery(this);
        Boxy.confirm("Are you sure?", function() { $this.submit(); }, {title: 'Confirm'});
        return false;

});
于 2014-12-31T09:55:22.107 回答
0

如果您有一个触发表单提交的提交按钮,您可以执行以下操作:

$(".button").click(function(ev) {
    ev.preventDefault();
    Boxy.confirm("Are you sure?", function() { $('form').submit(); }, {title: 'Confirm'});
});
于 2014-12-31T10:18:43.457 回答