0

I am curious about one thing to happen : when I hover a link in the bottom of the page there appears something like javascript:void(0); What does that mean ?

Thank you !

user3009269
  • 442
  • 6
  • 14

1 Answers1

1

The void operator evaluates the given expression and then returns undefined.

Usually, when you want to add a link that has an "onclick" function(and no href) you will do something like this:

<a href='javascript:void(0);' onclick='doSomething()'>Click Me</a> 

Clicking on this will return an undefined href and no navigate, but the onclick function will happen.

Read this:Void operator.

Amir Popovich
  • 29,350
  • 9
  • 53
  • 99