$('div').empty().append() - Not Working Correctly

$('div').empty().append() - Not Working Correctly

Hi,

The following method below seems to behave unexpectedly under certain conditions.

$('#myDiv').empty().append(someText);

I beleive, (imho), that the empty() function requires some time to execute and interferes with the append() function. I say this because adding a setTimeout() to delay the append() will correct the eratic behaviour.

My query is -
1. Is this a known occurence or my imagination?
2. Is it possible to add a callback function into empty() so that append() will only execute after empty() has completed its execution?
3. Any other remedies are welcomed.