SimpleModal Confirm未能提交表格 [英] SimpleModal Confirm fails to submit form

查看:71
本文介绍了SimpleModal Confirm未能提交表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jQuery SimpleModal 确认显示是/否确认提交表单时.

I'm trying to use jQuery SimpleModal Confirm to show a Yes/No confirmation when a form is submitted.

我修改了此处演示(列表中的最后一个),如下所示,以捕获和阻止表单提交.

I had modified the demo here (last in list), as follows, to catch and block the form submission.

但是,这似乎仅适用于jQuery 1.2.6,如果单击是",则最近升级到1.3.2会阻止提交表单.

However, this only seems to work with jQuery 1.2.6 a recent upgrade to 1.3.2 stops the form from being submitted if yes is clicked.

但是,我无法找出我的代码中现在有什么错误/不兼容.该演示(这是一个简单的window.href实现在两个版本中都适用).

I can't however, work out what in my code is now wrong / incompatible. The demo (which is a simple window.href implementation works in both versions).

$(document).ready(function () {

$('input.delete').click(function (e) {
        e.preventDefault();
        var target = $(e.target);
        confirm("Really delete this event?", function () {
            target.click()
        });
    });
 });

推荐答案

结合Funka和Eric的建议使其工作:

Got it working with a combination of Funka and Eric's advice:

$(document).ready(function () {  
$('.deleteconfirm').click(function (e) {
         e.preventDefault();
         confirm("Really delete this event?", function () {
         $('form#deleteform').submit()
         });
     });
 });

这篇关于SimpleModal Confirm未能提交表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆