This is often used with hyperlinks.
To prevent the page from refreshing, you could use void(0).
Using “#” in anchor tag: When writing the following code in the editor, the web page is refreshed after the alert message is shown.
- Advantages and Disadvantages of Using Stored Procedures - SQL
- How to use jQuery to Search and Replace HTML elements?
- How to Create a Bootstrap Spinner and Display on Screen till the data from the API loads ?
- How to autoplay audio on chrome ?
- How to hide element on small devices in Twitter Bootstrap ?
- How to place content under fixed flexbox navigation bar ?
- Materialize CSS | Colors
- Materialize CSS | Media
- Materialize CSS | Badges
- How to preload all Angular Bundles ?
- How to set href attribute at runtime?
- How to Add Google Locations Autocomplete to your Angular Application ?
- How to implement Facebook login in your Web app with Firebase ?
- Hot and Cold Deployment in Tomcat
- Difference between LOOK and C-LOOK Disk scheduling algorithms
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.