If you want to prevent your page from scrolling back to the top when clicking on a link, simply include the following code:
<a href="#a">Title</a>
To ensure the page scrolls back to the top, remove the "a" after the # symbol like so:
<a href="#">Title</a>
Try implementing this without the need for JavaScript. You can even make the #a jump to a different location on your page if desired.
UPDATE:
You may find this solution more suitable! Either add this to a separate js file or include it directly in your HTML document.
In a separate JS file (remember to reference it in your HTML):
$('#Add_Your_Id_Or_Class_Here').removeAttr('href');
For example: $('#link a').removeAttr('href');
, $('.link a').removeAttr('href');
, or $('a').removeAttr('href');
If you prefer inline implementation, use the following script within your HTML:
<script>
$('#Add_Your_Id_Or_Class_Here').removeAttr('href');
</script>
Feel free to explore other methods of achieving the same result. There are multiple ways to accomplish this task. Hope that clarifies things for you :)