Automatically Scroll to the Bottom of Div JQuery

Posted by


Have you ever wondered how to automatically scroll to the bottom of a div using JQuery? Well, you’re in luck! In this article, we will explore a simple JQuery example that will allow you to achieve this effortlessly. So, let’s dive right in!

Getting Started

Before we begin, make sure you have JQuery installed on your website. If you haven’t, don’t worry! You can easily include it by adding the following script tag to your HTML file.

<script src=""></script>

The Code

<html lang="en">
	<title>Scroll Down bottom</title>
	<script src=""></script>
	<div class="scroll-class" style="border: 1px solid black;height: 200px;overflow: scroll;width: 300px;">
			Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
			tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
			quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
			consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
			cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
			proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    <script type="text/javascript">
	     var objDiv = $(".scroll-class");
    	 var h = objDiv.get(0).scrollHeight;
    	 objDiv.animate({scrollTop: h});


Hopefully, It will help you …!!!

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x