Skip to main content

What is javascript:void(0);

By Sam Deering

JavaScript

Share:

Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

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 has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

New books out now!

Learn valuable skills with a practical introduction to Python programming!


Give yourself more options and write higher quality CSS with CSS Optimization Basics.