tags:

views:

18

answers:

1

Lets suppose that $(document).height() is 1000. Then i insert a new div at the bottom of the page with height=100. The $(document).height() should be 1100 but it keeps throwing 1000 to me.

How can i get the new $(document).height() dynamically?

Thank!

+1  A: 

$(document).height() works fine for me in this case.

If you're using a variable to hold the $(document).height(), make sure you update it when the action is performed to insert the new div at the bottom of the page.

HTML:

<span class="click">test</span>

JS:

$(".click").click(function(){
var height = $(document).height();
console.log(height);
for(var i=0; i< 10; i++){
$(".click").append("<div>test</div>");}
});
SteD
worked perfectly. thanks!
andufo