jQuery scrollTop() Method Last Updated : 10 Jul, 2023 Comments Improve Suggest changes 1 Likes Like Report The scrollTop() method is an inbuilt method in jQuery which is used to return the top vertical position of the scrollbar. Syntax: $(selector).scrollTop(position)Parameters: This method accepts a single parameter positiona which is optional. It is used to specify vertical scrollbar position in pixels. Return Value: This method returns the top position of the scroll bar. The below example illustrates the scrollTop() method in jQuery: Example: html <!DOCTYPE html> <html> <head> <title>scrollTop method</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function () { $("button").click(function () { alert($("div").scrollTop() + " px"); }); }); </script> <style> div { border: 1px solid black; width: 100px; height: 150px; overflow: auto; } </style> </head> <body> <center> <div> Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks!. Welcome to GeeksforGeeks! </div> <br> <!-- move the scroll bar and click on this button --> <button>Click Here !</button> </center> </body> </html> Output: Create Quiz Comment K kundankumarjha Follow 1 Improve K kundankumarjha Follow 1 Improve Article Tags : Web Technologies JQuery jQuery-Methods Explore jQuery Tutorial 7 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read Like