To scroll to the top of the page in javascript you can use the following snippet. This will scroll instant to the top left of the page, for a smoot scroll look at the jQuery Version.

Sample Javascript

window.scrollTo(0, 0);

2 thought on “How to scroll to the top of the page in javascript”

Leave a Reply