I'm trying to create a simple back to to button with jQuery which works well in Chrome but it doesn't work in Firefox and IE. Actually the JSFiddle below doesn't work even in Chrome.
HTML:
<body>
<div>
<span>My long text here.</span>
</div>
<div class="back-to-top" onclick="backToTop()"></div>
</body>
javaScript:
function backToTop () {
$("body").animate({ scrollTop: 0 }, 700);
}
And I'm using the latest jQuery library.