jQuery UI modal dialog form using remote content

前端 未结 1 787
耶瑟儿~
耶瑟儿~ 2021-01-14 09:26

I have a form in a web page dynamically generated and I would like to display it using a the jQuery UI modal dialog.

How can I display the modal dialog form with th

相关标签:
1条回答
  • 2021-01-14 10:00

    This will load the content of myform.html into the element with ID formContainer, make the formContainer a modal dialog (showing the form). When submitting the form, the dialog will be closed

    $("#formContainer").load("myform.html", function() {
        var container = $(this);
        container.dialog({
            modal: true
        })
        .find("form").submit(function() {
            container.dialog("close");
            return false;
        });
    });
    
    0 讨论(0)
提交回复
热议问题