Reputation: 4354
I'm opening a view in jquery modal dialog like this
$("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>
Now As soon as i close dialog once and then i reopen it again and enter username and password...I get ""
as value of both textbox...
What might be the possible reason for this, what i'm doing wrong?
LogIn function here
function LogIn() {
var username = $('#txtUserName').val();
var password = $('#txtPassword').val();
}
Upvotes: 1
Views: 2039
Reputation: 4489
Hey create closeframe
function in parent page
function closeIframe() {
$('#divClose').dialog('destroy');
}
and call that function from child page you can say model popup
window.parent.closeIframe();
For reference you can visit my Link
Upvotes: 1
Reputation: 2083
Try use the event "beforeClose" of the Jquery dialog
See more Documentation here
Upvotes: 0
Reputation: 2596
I think you have 2 elements in the DOM with the same ID. Try destroy the dialog instead of closing it.
$("#popup1").dialog('destroy').remove()
Upvotes: 2