单击按钮时弹出表单 [英] Pop up form on button click

查看:27
本文介绍了单击按钮时弹出表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在使用 jquery 单击按钮时在弹出窗口中创建表单?表单将有很少的输入字段和保存"&取消"按钮.因此,单击保存"后,表格中的信息将保存在数据库中并返回原始屏幕.我想要一个淡入弹出窗口.

Is there a way to create a form in pop-up window on click of a button using jquery? Form will have few input fields and 'Save' & 'Cancel' buttons. So on clicking 'Save', the information in form will be saved in database and will be back to original screen. I would like to have a fade-in pop up window.

推荐答案

使用这段代码

HTML

<div id="divdeps" style="display:none" title=""></div>

DOM 上的 Jquery 准备就绪

Jquery on DOM ready

$("#divdeps").dialog({
    autoOpen: false,
    show: 'slide',
    resizable: false,
    position: 'center',
    stack: true,
    height: 'auto',
    width: 'auto',
    modal: true
});

此代码将初始化一个对话框,并将其置于准备打开和连续关闭的状态.如果您想在页面加载时打开对话框,请在您已经添加到文档就绪的代码之后添加这行代码:

This code will initialize a Dialog and put it in state ready to be open and successively closed. If you want to open the dialog when the page loads then add this line of code just after the code you've already added in document ready:

$("#divdeps").dialog('open');

如果您想在点击事件之后打开对话框,请在应该触发打开的元素的点击事件上添加相同的代码.

If instead you want to open the Dialog following a click event add the same code on the click event of the element that should fire the opening.

在 myDialog DIV 中添加您的表单.如果您需要有关表单提交的更多帮助,请向我们提供更多详细信息...

Add your form inside the myDialog DIV. If you need more help regarding the form submission just give us more details...

这篇关于单击按钮时弹出表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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