javascripthtmlonclickdom-events

I have an anchor tag like `<a href="javascript:;" onclick="return false;">`. Does this do anything?


I'm trying to track down some javascript that is running when an anchor tag is clicked. Using Firebug I found this code:

<a href="javascript:;" onclick="return false;">
   ...
</a>

What, if anything would href="javascript:;" onclick="return false;" do here?

This is an abbreviated version of the code, if you'd like to see the full version let me know and I can throw it up. It didn't appear relevant to the question but I could be wrong...


Solution

  • there will be an event listener waiting for this link to be clicked.

    and that return false prevents the browser from executing the redirect