.html() problem

.html() problem

I am loading some html into a div
Then I need to calculate the height of the div once the html is added.

My problem is that the height calculation occurs before the html is loaded sometimes.

Here is my code executed at the completion of the ajax call to get the html.

  1. if (value) {
        $('#lmenu').html(value);
        pageheight();       
    }



the pageheight function is

  1. function pageheight() {
        var menuheight = parseInt($("#lmenu").height()) + parseInt($("#menu").height());       
        var recheight = parseInt($(".ui-page-active").height());       
       
        if (menuheight > recheight) {
            $(".ui-page-active").height(menuheight);   
        }       
    }








I tried checking if the div was not empty before running the function, but the function didn't get called. A shame .html doesn't have a callback, but my research on this problem indicates that it shouldn't be required.