how to scroll up to the top of html with jquery animate scrolltop?

My goal is to scroll up to the top of html with any trigger (clicks) with jquery animate scrollTop. My expected result, when the button clicked content will scroll all the way to the top. So, this is my attempt:

Html code:

<a class="go_back_to_top">Go back top</a>

Jquery Code:

<script>

$(document).on('click', ".go_back_to_top", function () {
$('html,body').animate({ scrollTop: 0 }, 'slow');
});

</script>