I am using jquery dialog for for user to enter comments and than i had add and cancel button within jquery dialog. I have a logic like when they hit add i need to insert text in database and refresh only iframe within the whole html page. Everything works perfect. But when iframe refresh than it keep the old dialog in dom event. so when i click second time on than it appear with expected screen. But i am not sure why on first click it will keep the old jquery dialog.
I am using this code :;
$("#dialog-confirm").dialog({
resizable: false,
height: 200,
modal: true,
autoOpen: false,
buttons: [
{
id: "add_btn",
text: "Add",
disabled: true,
click: function () {
// logic of adding text in db goes here.
$(this).dialog("close");
}
},
{
id: "cancel_btn",
text: "Cancel",
click: function () {
$(this).dialog("close");
}
}
]
});
Thanks in advance.