使用远程内容的jQuery UI模式对话框 [英] jQuery UI modal dialog form using remote content

查看:176
本文介绍了使用远程内容的jQuery UI模式对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在动态生成的网页中有一个表单,我想使用jQuery UI模式对话框来显示它。

当我点击一个链接Open Form时,如何以远程现有表单(myform.html)作为内容显示模态对话框?
点击提交按钮应该关闭对话框。

解决方案

这将加载 myform.html 放入ID formContainer 的元素中,使 formContainer 为模态对话框(显示表格)。提交表单时,对话框将被关闭。

  $(#formContainer)。load(myform.html,函数(){
var container = $(this);
container.dialog({
modal:true
})
.find(form)。 submit(function(){
container.dialog(close);
return false;
});
});


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 the remote existing form (myform.html) as content when I click on a link "Open Form"? Clicking on submit button should close the dialog form.

解决方案

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;
    });
});

这篇关于使用远程内容的jQuery UI模式对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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