JSFiddle - React, Tailwind, and code Playground

by peterbenoit

HTML

<span>top</span>
<a href="#top" style="position:absolute;top:2000px">jquery scroll to the top</a>

JavaScript

$("a[href='#top']").click(function() {
    $("html, body").animate({
        scrollTop: 0
    }, "slow");
    return false;
});