[英]Get values of Textbox in jquery Modal dialog
我在这样的jquery模态对话框中打开一个视图
$("a.OpenView").on('click', function () {
></div>")
.addClass("dialog closePopup")
.attr("id", "popup1")
.appendTo("body")
.load("../../ControllerName/_partialView")
.dialog({
title: "LogIn",
modal: true,
height: "auto",
minHeight: 260,
maxHeight: 260,
width: 450,
left: 0,
zIndex: 1001
});
});
HTML
<table cellpadding="0" cellspacing="0">
<tr>
<td align="center"><input name="" type="text" value="" title="User Name" class="width190" id="txtUserName" onfocus="txtFocus(this)" onblur="txtFBlur(this,'0')"/></td>
<td align="center"><input name="" type="password" value="" title="Password" class="width190" id="txtPassword" onfocus="txtFocus(this)" onblur="txtFBlur(this,'1')"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="" type="submit" class="blue_btn" value="Sign In" id="btnLogIn" onclick="javascript:return LogIn()"/></td>
</tr>
</table>
现在,一旦我关闭对话框,然后我再次重新打开它并输入用户名和密码......我得到""
作为两个文本框的值...
可能的原因是什么,我做错了什么?
这里有LogIn功能
function LogIn() {
var username = $('#txtUserName').val();
var password = $('#txtPassword').val();
}
我认为DOM中有2个元素具有相同的ID。 尝试销毁对话框而不是关闭它。
$("#popup1").dialog('destroy').remove()
嘿在父页面中创建closeframe
功能
function closeIframe() {
$('#divClose').dialog('destroy');
}
并从子页面调用该函数,您可以说model popup
window.parent.closeIframe();
作为参考,您可以访问我的链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.