5
  <a href="javascript:void(0)" id="loginlink">login</a>

I've seen such anchor tag's href property having javascript:void(0) value many times. I don't know what exactly that means.I saw this when working with angular 5. Why is javascript:void(0) used as a value for href property?

lwairore
  • 513
  • 5
  • 11
Guvaliour
  • 327
  • 1
  • 4
  • 17

1 Answers1

10
javascript:void(0)

The snippet show above simply ignores the link "click." This can be done in a similar fashion by the following:

<a href="#" onclick="return false;">link</a>
Rob
  • 147
  • 1
  • 5