Dialog Box Not Working properly
Posted
by
user1360694
on Stack Overflow
See other posts from Stack Overflow
or by user1360694
Published on 2012-06-12T10:38:47Z
Indexed on
2012/06/12
10:39 UTC
Read the original article
Hit count: 176
function showPopup(){
var popup = $('<div>').dialog();
popup.html('<div id="mydiv"></div>');
for (var i=1; i<5; i++)
setContent($('#mydiv'));
popup.dialog("option", "buttons", {
"Add": function(){
//code to add
$(this).dialog('close');
$(this).dialog('destroy');
},
"Cancel": function(){
//code to add
$(this).dialog('close');
$(this).dialog('destroy');
},
});
}
function setContent(container){
container.append('<p>sadfsdfsdfsdfdsf</p>');
}
On clicking a "ADD BUTTON" the showPopup function is called which displays a dialog box setting its content from the setContent method. On the first click the content is displayed properly while on further clicks(after the previous dialog is closed) no content is displayed.
Can anyone help with this.
© Stack Overflow or respective owner