How To Make An Anchor Tag Refer To Nothing? - Tutorialspoint

  • Home
  • Library
  • Online Compilers
  • Jobs
  • Whiteboard
  • Tools
  • Articles
  • Write & Earn
  • Courses
  • Certifications
Menu Categories Login
  • Switch theme
  • SQL
  • HTML
  • CSS
  • Javascript
  • Python
  • Java
  • C
  • C++
  • PHP
  • Scala
  • C#
  • Tailwind CSS
  • Node.js
  • MySQL
  • MongoDB
  • PL/SQL
  • Swift
  • Bootstrap
  • R
  • Machine Learning
  • Blockchain
  • Angular
  • React Native
  • Computer Fundamentals
  • Compiler Design
  • Operating System
  • Data Structure and Algorithms
  • Computer Network
  • DBMS
  • Excel
Technical Questions and Answers
  • Trending Categories
  • Data Structure Data Structure
  • Networking Networking
  • RDBMS RDBMS
  • Operating System Operating System
  • Java Java
  • MS Excel MS Excel
  • iOS iOS
  • HTML HTML
  • CSS CSS
  • Android Android
  • Python Python
  • C Programming C Programming
  • C++ C++
  • C# C#
  • MongoDB MongoDB
  • MySQL MySQL
  • Javascript Javascript
  • PHP PHP
  • Physics Physics
  • Chemistry Chemistry
  • Biology Biology
  • Mathematics Mathematics
  • English English
  • Economics Economics
  • Psychology Psychology
  • Social Studies Social Studies
  • Fashion Studies Fashion Studies
  • Legal Studies Legal Studies
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary
  • Who is Who
How to make an anchor tag refer to nothing? JavascriptWeb DevelopmentFront End Technology

To make an anchor tag refer to nothing, use “javascript: void(0)”. The following link does nothing because the expression "0" has no effect in JavaScript. Here the expression "0" is evaluated, but it is not loaded back into the current document.

Example

Live Demo

<html> <head> <script> <!-- //--> </script> </head> <body> <p>Click the following, This won't react at all...</p> <a href="javascript:void(0)">Click me!</a> </body> </html>

varun varun Updated on: 16-Jun-2020

5K+ Views

Từ khóa » Html Onclick Do Nothing