Javascript:void (0) meaning

Source: Internet
Author: User

From rookie tutorial

The key in Javascript:void (0) is the Void keyword, which is a very important keyword in JavaScript, which specifies that an expression is evaluated but does not return a value.

<a href= "javascript:void (0)" > Click here Nothing will happen </a>

void () simply means that no value is returned, but the expression inside the parentheses is still to be run, as

<a href= "javascript:void (alert (' Warning!!! '))" > I!</a>.

  

The difference between href= "#" and href= "javascript:void (0)"

# contains a location information, the default anchor is #top that is the top of the page.

and javascript:void (0), only represents a dead link.

When the page is long, it uses # to locate the page in the format:# + ID.

If you want to define a dead link please use Javascript:void (0).

Javascript:void (0) meaning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.