jQuery scrollTop() method not working

You have to use window instead of html:

$(window).scrollTop( $("#topofthePage").offset().top );

Note that window should not be enclosed in quotes as i’ts an object and not a tag.

Leave a Comment