Source: <a href= "javascript:test (); void (0);" >here</a>
Here: in JavaScript, Void is an operator that specifies that an expression is evaluated but does not return a value.
The void operator uses the following format:
1. javascript:void (expression)
2. Javascript:void expression
Expression is a standard of Javascript to evaluate. The parentheses on the outside of the expression are optional, given the normalization, and the habit of forming good habits, it is advisable to write it up.
When we use the void operator to specify a hyperlink, the expression is evaluated but no content is loaded at the current document.
There are several situations:
(1) The following code creates a hyperlink that, when the user links, void (0) evaluates to 0, so there is no effect on Javascript.
<href= "javascript:void (0)"> Click here nothing will happen </ a > //javascript:void (0) represents only a dead link
(2) The following code creates a hyperlink that submits the form when the user clicks it.
<href= "javascript:void (Document.form.submit ())"> Click here to submit the form </a>
What does "javascript:void (0)" mean in JavaScript?