How to execute a function after opening jQueryUI dialog?
On my webpage I have links such as:
<div id="toolbarButtons">
<a href="actualites/addLink" id="liens" rel="lien" title="Insérer un lien" class="toolbarButton"><span><img src="pub/struct/picto/icon_toolbar-link.gif" alt="Liens" />Lien</span></a>
<a href="actualites/addImage" rel="image" title="Insérer une image" id="img" class="toolbarButton"><span><img src="pub/struct/picto/icon_toolbar-img.gif" alt="Liens" /> Image(s)</span></a>
</div>
<div id="dialogbox"></div>
First of all, I launched my dialog by calling:
initDialog : function() {
$('#dialogbox').dialog({
bgiframe:true,
autoOpen:false,
width:500,
modal:true
});
}
then I attach the dialog to the click event:
$('.toolbarButton').click(function(e){
e.preventDefault();
actu.dialogManager($(this));
});
dialogManager : function(elem) {
elem.blur();
var title = elem.attr('title');
var href = elem.attr('href');
var rel = elem.attr('rel');
$('#dialogbox').dialog('option','title',title);
if(rel == 'lien')
{
$('#dialogbox').dialog('option','buttons',{
'Add' : function(){
//TODO
},
'Cancel' : function(){
$('#linkText').val('');
$('#linkUrl').val('');
$(this).dialog('close');
}
});
$('#dialogbox').load(href).dialog('open');
}
}
As you can see, the contents of the dialog box are selected using ajax. A dialog box contains some input. I have the last function, which should edit the contents of the input, but I do not know how and where to call it. It must be called after the opening of the dialogue will be effective. How can i do this?
do it juste after
$('#dialogbox').load(href).dialog('open');
will not work due to asynchronous loading (called before the dialog is fully loaded).
Thank you for your help.
+5