$(document).ready(function(){
function getDocumentHeight()
{
// What's the page height?
var height = $('#mainbody').height();
alert(height);
...
getDocumentHeight(); }
jQuery keeps alerting null for the height of my #mainbody div. I don’t get why, it should at least be 500px or so.
If the content is being loaded dynmically, the elements may not have a height yet. Try moving this code to the bottom of the page, directly above and see if that resolves.
UPDATE:
Try placing your code in
outside of your