Could someone assist me with a coding issue I am facing? I would like to be able to go to the top of the page when clicking on a link and have the link open in the same tab.
I attempted to implement this functionality using the following code, however, I can only successfully navigate to the top of the page and the link does not open as intended.
Here is my JavaScript code snippet:
$(document).ready(function(){
$('.scrollToTop').click(function(){
$('html, body').animate({scrollTop : 0},1800);
return false;
});
});
Below is the HTML link that is causing me trouble:
<a href="./current_page?page=5" class="scrollToTop">></a>
I would greatly appreciate any assistance or advice on how to resolve this issue. Thank you!