Ideal solution would be with some custom callback for the append, or something similar... but can't think of an exact solution like that right now.
Another solution, which although not ideal, it is simple and *could* work quite well, is calling the ADD_DHTML function with a setTimeout. setTimeout('ADD_DHTML($j(this).attr("id"));', 1000); // not tested Andy789 wrote: > Hi All, > > This is my workflow logic: > > 1. I submit $.post AJAX request and get the callback data > 2. This data is a raw html code, which is used to append some div > 3. I have to scroll through all the new appended elements and make > them draggable > > The problem is that the drag activation function starts BEFORE all the > new elements are appended, i.e. create a new DOM, therefore, usually > first 1-2 elements are not draggable. All the rest of them are OK. > > This is a fragment of the code: > > $j.post("canvas_save.php", queryString, > function(data){ > > if ($j.browser.msie){ > $j("div#restored").append(data); > $j("div#restored").children("div").each(function(i){ > ADD_DHTML($j(this).attr("id")); //this starts before all the > children are appended!!!!! > }); > } > }); > > Any suggestions how to synchronize this? > > Thanks!!