Why use void(0)?

Viewed 3545

Let's assume for a moment that you must create a JavaScript link that doesn't have a meaningful href. (I know that this practice is questionable.) In this case, why do so many people use...

<a href="javascript:void(0);"> My link </a> 

Knowing that void(0) evaluates to undefined, can I simply use the following logic?

<a href="javascript:undefined;"> My link </a>
2 Answers
Related