Jquery $("body").height() Returns Undefined
I have a call like this: $('#ContextMenuModal').height($('body').height()); However $('body').height() returns undefined when I view it in Firebug. What would cause jQuery to retu
Solution 1:
Simply use
$(document).height() // - $('body').offset().top
and / or
$(window).height()
instead $('body').height()
To expand a bit,
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
As bažmegakapa points out, there is a slight difference, albeit a few pixels. The true height of the body can be calculated by subtracting the body offset from the document height (like I mentioned above):
$(document).height() - $('body').offset().top
Solution 2:
Use this-
$("body").css("height")
well i will say jquery is not needed-
this.style.height;//it will not work if you add it as inline js.
Post a Comment for "Jquery $("body").height() Returns Undefined"