Thats right, the only things that need a callback are ajax and animations
(unless im missing something)

On 7/25/07, Klaus Hartl <[EMAIL PROTECTED]> wrote:


juliandormon wrote:
>
> I'm adding html into a div using append. I want to update my custom
scrollbar
> plugin which is in a parent div after the append has completed loading
to
> accommodate the new height of the content in the child div. What's the
> proper way of doing a callback after append for a different div?
>
> I cannot simply chain this because it's a different div.
>
> This is what I have but the callback paramater does not seem to work for
> append - perhaps it's not a parameter at all?
> <div id="parentDiv" class="scrollBar" >
> <div id=" childDiv" class="appendedContentGoesHere"></div>
> </div>
>
>
$("#childDiv").append('mygreatHTML',function(){$("#parentDiv").updateScrollBar()})
>
> Much appreciated!

You don't need a callback, such operations happen one after the other in
  JavaScript:

$("#childDiv").append('mygreatHTML');
$("#parentDiv").updateScrollBar();

You could of course still make a chain:

$("#childDiv").append('mygreatHTML').parent().updateScrollBar();

That frees you from having to use another hardcoded id...



--Klaus

Reply via email to