Home >Web Front-end >JS Tutorial >What does javascript:void(0) mean and an example introduction_javascript skills
void is an operator in Javascript, which specifies that an expression is to be evaluated but does not return a value.
void operator usage format is as follows:
1. javascript:void (expression)
2. javascript:void expression
expression is a Javascript standard to be calculated expression. The parentheses outside the expression are optional, but are a good practice to write. (Implementation version Navigator 3.0)
You can use the void operator to specify a hyperlink. The expression will be evaluated but nothing will be loaded into the current document.
The following code creates a hyperlink that will cause nothing to happen to the user later. When the user links, void(0) evaluates to 0, but nothing happens on Javascript:
Nothing happens here< ;/A>
The following code creates a hyperlink and the user will submit the form when clicking:
Submit form here
a href=# and a href=javascript:void(0) There are several ways to link:
# contains a location information
The default anchor is #top, which is the top of the web page
And javascript:void(0) only represents a dead link
This is why sometimes the page is very long and the browsing link is obviously #
Jumps to the top of the page
, but javascript:void(0) is not like this
, so it is best to use
void(0)
or
< when calling the script input onclick>