<a href="#" onclick="alert('I am reloading!!!')">Click me!</a>output
Browser ViewWhen you run the above example, you can see a message is displayed in an alert box as intended and void(0) prevents the page from reloading . So the void operator can be useful when you need to call another function that may have otherwise resulted in an unwanted page refresh.
- What is noscript tag?
- Difference between '=', '==' and '===' operators?
- What is Browser Object Model
- How to test a string as a literal and as an object ?
- What is Associative Array? How do we use it?
- What's the Difference Between Class and Prototypal Inheritance?
- Event bubbling and Event Capturing in JavScript?
- What is the difference between .call() and .apply()?
- What is an immediately-invoked function expression?
- What Are RESTful (REpresentational State Transfer)Web Services?
- TypeError: document.getelementbyid(...) is null
- What's the difference between Null and Undefined?