for scroll to top should body or html be used code example Example: javascript scroll to top of page //Instant scroll to top of page window.scrollTo(0, 0);