void is an operator in Javascript that specifies to evaluate an expression but does not return a value.
The void operator usage format is as follows:
1.
program code
javascript: void (expression)
2.
program code
javascript: void expression
like:
program code
<a href="javascript:void(0)">Click here to see the effect</a> //Actually equivalent to a dead link.
like:
program code
<a href="javascript:void(document.form.submit())">Click here to submit the form</a> //The form will be submitted when the user clicks
Notice:
program code
<a href="#">Click here</a>
and
program code
<a href="javascript:void(0)">Click here</a>
The difference:
Quote content
#Just contains a location information. The default anchor is #Top, which is the top of the web page;
And javascript:void(0) is a dead link.