Jquery UI dialog initiation? Is there a way to bind it?
Posted
by Raja
on Stack Overflow
See other posts from Stack Overflow
or by Raja
Published on 2010-05-24T17:37:42Z
Indexed on
2010/05/24
17:41 UTC
Read the original article
Hit count: 191
I am trying to bind the dialog initiation (which happens in document ready) to a live or delegate for a div. Something like this for click event:
$("#divSelectedContacts").delegate("span", "hover", function () {
$(this).toggleClass("strikeOut");
});
for this:
$("#divContacts").dialog('destroy').dialog({
bgiframe: true,
resizable: false,
autoOpen: false,
height: 600,
width: 425,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
Cancel: function () {
//basically do nothing
$(this).dialog("close");
},
'Done': function () {
//get all the selected ppl and store it in To
//alert($("#divSelectedContacts").html());
$("#divTo").empty().html($("#divSelectedContacts").html());
$(this).dialog("close");
}
}
});
Is this possible to use delegate for this so that it is bound forever? The main problem is I dynamically load the html in one of the tabs and when I include the dialog script in the HTML then it creates multiple dialogs and does not work. Any help is much appreciated.
Thanks in advance.
© Stack Overflow or respective owner