JavaScript
Article

What is javascript:void(0);

By Sam Deering

What is javascript:void(0);? This operator allows inserting expressions that produce side effects into places where an expression that evaluates to undefined is desired.

The void operator evaluates the given expression and then returns undefined.

Example Usage

Click here to do nothing
Click here for green background

See this post for further info: Different ways to run a JavaScript function

Further Reading

Sam Deering
Meet the author
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.