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.
- What does the “+” (plus sign) CSS selector mean?
- What does '<?=' short open tag mean in PHP ?
- What does it mean to start a PHP function with an ampersand?
- What does the Double Star operator mean in Python?
- What is the difference between MEAN.js and MEAN.io?
- How does Duff's Device work?
- Why does sizeof(x++) not increment x in C?
- What does the CSS rule “clear: both” do?
- What does $$ (dollar dollar or double dollar) means in PHP ?
- Count maximum elements of an array whose absolute difference does not exceed K
- What does main() return in C and C++?
- Where does PHP store the error log? (php5, apache, fastcgi, cpanel)
- What does symbol tilde (~) denotes in CSS ?
- What purpose does a <script> tag serve inside of a <noscript> tag?
- Why does AngularJS include an empty option in select ?
- How does Multiprotocol Label Switching (MPLS) Routing work ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.