Scroll To Top When DIV Clicked?

html, javascript, jquery, scroll

Solution

$('div').on("click",function(){
      $(window).scrollTop(0);
});

You can insert every kind of html tag into the bracket's

Problem

We all know that scroll to top with named anchors via HTML is possible but is it possible to scroll to the top when another HTML element is clicked that is not surrounded by tags? For instance, a DIV? EDIT: Apologies all, I did not see this was a duplicate question. I did a search and didn't find anything.

Original source

Related problems