Modal dialog missing image on form submit, IE9+

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 13:30:14

Try canceling the form submission:

$('form input').click(function() {
    $(".modal").dialog('open');
    return false;
});

Right now you have a form with a submit button and when someone clicks on the submit button this form gets sent to the server and the browser redirects away from its current location. You cannot expect any more javascript to continue executing at that stage. By returning false from the submit handler you are canceling the default action.

Figured out a solution. So I changed:

$('form input').click(function() {
    $(".modal").dialog('open');
});

To:

$('form input').click(function(e) {
        var $form = $(this).parents('form');
        $(".modal").on('dialogopen', function() {$form.submit();});
        $(".modal").dialog('open');
        e.preventDefault();
    });

This puts off the form submit until the js to open the dialog has completed. Like I said. Seems to be an IE9 and IE10 issue only. FireFox, Chrome, etc. work fine with this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!