JQuery UI modal dialog form using remote content

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

How to display a modal dialog form with a deleted existing form (myform.html) as content when I click on the "Open form" link? Clicking the Submit button should close the dialog form.

+3
source share
1 answer

This will load the contents myform.htmlinto the element with the identifier formContainer, make a formContainermodal dialog box (showing the form). When you submit 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;
    });
});
+5
source

Source: https://habr.com/ru/post/1756635/


All Articles