In this tutorial, we will learn How to Disable a Anchor Tag in HTML


Example 1:

<!DOCTYPE html>
<html>
<head>
    <title>How to Disable a Anchor Tag in HTML? - rathorji.in</title>
    <style type="text/css">
        a.disabled {
          pointer-events: none;
          cursor: default;
          opacity: .6;
        }
    </style>
</head>
<body>
  
<h1>How to Disable a Anchor Tag in HTML? - rathorji.in</h1>
  
<a href="https://www.rathorji.in" class="disabled">Go to rathorji.in</a>
  
</body>
</html>

Example 2:

<!DOCTYPE html>
<html>
<head>
    <title>How to Disable a Anchor Tag in HTML? - rathorji.in</title>
</head>
<body>
  
<h1>How to Disable a Anchor Tag in HTML? - rathorji.in</h1>
  
<a href="https://www.rathorji.in" onclick="return false;">Go to rathorji.in</a>
  
</body>
</html>

Example 3:

<!DOCTYPE html>
<html>
<head>
    <title>How to Disable a Anchor Tag in HTML? - rathorji.in</title>
</head>
<body>
  
<h1>How to Disable a Anchor Tag in HTML? - rathorji.in</h1>
  
<a href="javascript:function() { return false; }">Go to rathorji.in</a>
  
</body>
</html>


Example 4:

<!DOCTYPE html>
<html>
<head>
    <title>How to Disable a Anchor Tag in HTML? - rathorji.in</title>
    <style type="text/css">
        a[disabled="disabled"] {
            pointer-events: none;
        }
    </style>
</head>
<body>
  
<h1>How to Disable a Anchor Tag in HTML? - rathorji.in</h1>
  
<a href="https://www.rathorji.in" disabled="disabled">Go to rathorji.in</a>
  
</body>
</html>


May this example help you