You must return false from the click handler associated with the anchor. Given HTML:
<a id="example" href="/whatever"/>
JS should look like this:
document.getElementById('example').onclick = customAnchorReturn; function customAnchorReturn() {
or using jQuery:
$('a#example').click(function(){
This way, JS will be unobtrusive, and if JS is disabled, the anchor will work.
sebarmeli
source share