Force move to top of browser with jQuery

I have a website where I needed the user when they clicked a button to go back to the top of the page. For some reason, scrollTop() in jquery did not work and window.scroll in native javascript could not get to work either. So I added this oneliner suggested by Nizam at: $(‘html, body’).animate({ scrollTop: […]