You are currently viewing How to disable an anchor tag in HTML?

How to disable an anchor tag in HTML?

Hello learner,

For your support, we made this tutorial  Disable an Anchor Tag in HTML. This tutorial is centered around how to impair anchor tags in HTML utilizing JavaScript. you will figure out how to handicap a tag in HTML. We will assist you with giving an illustration of how to handicap a component in JavaScript.

This article goes point by point on the most proficient method to debilitate a tag in jQuery.

Follow the steps for how to debilitate an anchor tag in jQuery.

To handicap a tag I will provide you with a few instances of how to debilitate anchor tags utilizing CSS, jQuery, and JavaScript.

in this way, we should see cry some straightforward model that will help you how to cripple a tag href in HTML.

Example 1:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable an Anchor Tag in HTML? - smallseomaster.com</title>

<style type="text/css">

 a.disabled {

 pointer-events: none;

 cursor: default;

 opacity: .6;}

</style>

</head>

<body>
<h1>How to Disable an Anchor Tag in HTML? - smallseomaster.com</h1>

<a href="https://www.smallseomaster.com" class="disabled">Go to smallseomaster.com</a>

</body>

</html>

 

Example 2:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable an Anchor Tag in HTML? - smallseomaster.com</title>

</head>

<body>

<h1>How to Disable an Anchor Tag in HTML? - smallseomaster.com</h1>

<a href="https://www.smallseomaster.com" onclick="return false;">Go to smallseomaster.com</a>

</body>

</html>

 

Example 3:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable an Anchor Tag in HTML? - smallseomaster.com</title>

</head>

<body>

<h1>How to Disable a Anchor Tag in HTML? - smallseomaster.com</h1>

<a href="javascript:function() { return false; }">Go to smallseomaster.com</a>

</body>

</html>


Example 4:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable an Anchor Tag in HTML? - smallseomaster.com</title>

<style type="text/css">

 a[disabled="disabled"] {

 pointer-events: none;

}

</style>

</head>

<body>

<h1>How to Disable an Anchor Tag in HTML? - smallseomaster.com</h1>

<a href="https://www.smallseomaster.com" disabled="disabled">Go to smallseomaster.com</a>

</body>

</html>

Leave a Reply