Scroll to bottom of Div on page load (jQuery)

The other solutions here don’t actually work for divs with lots of content — it “maxes out” scrolling down to the height of the div (instead of the height of the content of the div). So they’ll work, unless you have more than double the div’s height in content inside of it.

Here is the correct version:

$('#div1').scrollTop($('#div1')[0].scrollHeight);

or jQuery 1.6+ version:

var d = $('#div1');
d.scrollTop(d.prop("scrollHeight"));

Or animated:

$("#div1").animate({ scrollTop: $('#div1').prop("scrollHeight")}, 1000);

Leave a Comment