0

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...

Abe Miessler
  • 79,479
  • 96
  • 291
  • 470

3 Answers3

3

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

and that return false prevents the browser from executing the redirect

david.wosnitza
  • 763
  • 4
  • 10
0

Well the return false prevents the link from doing anything, so if the href was url, the link would not take you there, it wouldn't do anything.

I don't think javascript:; will do anything.

Paul Creasey
  • 27,719
  • 10
  • 52
  • 89
0

It cancels the click event normally attached to a a tag

Martin Jespersen
  • 24,934
  • 6
  • 54
  • 66