How to disable a link on a webpage using CSS, JavaScript, jQuery etc?

We all know that an anchor HTML tag generates a link on a webpage. But in many cases, we may need to disable the link and just want to show the text. We can disable the link in multiple ways. Following are some ways of disabling a link of a webpage:

By using CSS

By using pointer-events CSS property we can easily disable a link. Following is an example:

.inactive {
  pointer-events: none;
  cursor: default;
  text-decoration: none;
}

<a href="home.html" class="inactive">Link</a>

Here is a good article about pointer-events property.

Share