All- I know this has been asked, but the previous solutions don't seem to apply to my situation.
I have a simple table with a number of records in each row, with the final column being a delete hyperlink. I'm trying to use the dialog to pop up and confirm delete. This works perfectly if I use explicit names of the div where the dialog is (I position it exactly one div above the div where the table is). I use a destroy first which seems to solve the "only opens once" problem, as long as as I name the dialog div. I'm trying to universalize the code, so I'd rather get away from explicitly naming the div where the dialog will live, but rather refer to the prev div. This works the first time, but subsequent clicks do not:
<code>
$(".deleteLinkDiag a").livequery('click',function() {
var myParent = $(this).parents("div:eq(0)"); //container div to be replaced
var myDiag = $(myParent).prev("div"); //one div before container div
var urlLoad = $(this).attr("href");
$(myDiag).dialog('destroy');
$(myDiag).dialog({
bgiframe: true,
resizable: false,
height:140,
modal: true,
autoOpen: false,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
"Confirmz":function()
{
myParent.load(urlLoad, function() { });
$(this).dialog("close");
},
Cancel: function()
{
$(this).dialog("close");
}
},
//close: function(ev, ui) { $(this).dialog('destroy');}
});
$(myDiag).dialog('open');
return false;
});
</code>
Any ideas?