How can you get your code to wait for html() and append() functions to complete?
<p>I'm setting the html of the body element in an iframe to a string str, then I want to access that content on the next line (here just using an alert call to display the content) but the html and append functions haven't completed by the time the alert statement is called.</p>

<pre><code>$(function(){
....
$("#notes-tab span.add_draft").bind("click", function(e){
    var str = '';
    $(this).parent().siblings(".tab-content").children(".para").each(function(ind) {
        str += $(this).find('div:first').html();
    });
    var curr = $("#content_rte").contents().find("body").html();
    if (curr == ' ' || curr == '&lt;br&gt;') {
        $("#content_rte").contents().find("body").html(str);
    }
    else {
        $("#content_rte").contents().find("body").append(str);
    }
    alert($("#content_rte").contents().find("body").html());
});
});
</code></pre>

<p>And of course neither the html nor the append functions take callbacks. </p>

<p>Could someone tell me how one normally accomplishes waiting for the DOM to be changed before proceeding? </p>
