Home > Web Front-end > JS Tutorial > Explanation of the specific meaning of void(0) in JavaScript_Basic knowledge

Explanation of the specific meaning of void(0) in JavaScript_Basic knowledge

WBOY
Release: 2016-05-16 19:18:45
Original
1096 people have browsed it

void is an operator in JavaScript that specifies to evaluate an expression 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 expression to be calculated . The parentheses outside the expression are optional, but it is a good practice to write them. (Implementation version Navigator 3.0 )

You can use the void operator to specify a hyperlink. The expression is evaluated but nothing is loaded into the current document.

The following code creates a hyperlink that does nothing when the user clicks on it. When the user clicks the link, void(0) evaluates to 0, but has no effect on JavaScript.

Click here and nothing will happen

The code below creates a hyperlink that when clicked by the user will submit the form.


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template