Href = "javascript: void (0);" and,
There are two ways to set the <a> label to null link. The first is href = "#", and the other is href = "javascript: void (0 );". Both methods set the label to null link, but the two methods are somewhat different.
Href = "#". When you click it, it will jump to the top of the page, which is equivalent to clicking an anchor. A # identifier will appear after the URL.
While href = "javascript: void (0);" is to execute a javascript expression. Void (0) does not execute or return anything, so no jump occurs.
We recommend that you use href = "javascript: void (0 );"
A href = "javascript: void (0)" What is it? What is the difference between adding or not?
<A href = "javascript: void (0)"> click </a> the link does not return to the top of the page.
<A href = "#"> click </a>.
What is the void () function in href = "javascript: void (0 )"?
Void is an operator in JavaScript. Its usage format is as follows:
1. javascript: void (expression)
2. javascript: void expression
Expression is a standard Javascript expression to be calculated. Parentheses outside the expression are optional, but it is a good habit to write them. (Implement version Navigator 3.0)
In your example, use the void operator to specify a hyperlink. The expression will be calculated but will not load any content in the current document. That is to say, when the user does not do anything (jump ).