Search code snippets, questions, articles...

Scroll to the bottom of a div using Javascript

The code can be used to scroll to the bottom of a div using javascript. We are using scrollTop and scrollHeight properties of elements for this.
var my_div = document.getElementById("my_div");
my_div.scrollTop = my_div.scrollHeight;
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet