I have a button on a page and I want that when it is clicked, the page scrolls to the 0 position.
HTML
Back to top
Try this code:
$("#button").on("click", function() { $("body").scrollTop(0); });
Method on binds a click event to the button and scrollTop scrolls your body to 0 position.
on
click
scrollTop
body