This tutorial focuses on using javascript to disable the anchor tag in HTML. You’ll discover how to make a tag in HTML inactive. We’ll assist you by providing an example of how to disable a JavaScript element. The process of disabling a tag in jQuery is covered in detail in this article. The steps to disable an anchor tag in jQuery are listed below.
I’ll show you several examples of how to use javascript, jquery, and CSS to disable anchor tags if you want to do that.
Now, let’s look at a few straightforward examples that will show you how to remove a tag href in HTML below.
Example 1:
<!DOCTYPE html>
<html>
<head>
<title>How to Disable a Anchor Tag in HTML? </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? </h1>
<a href="https://www.itsolutionstuff.com" class="disabled">Go to ItSolutionStuff.com</a>
</body>
</html>
Example 2:
<!DOCTYPE html>
<html>
<head>
<title>How to Disable a Anchor Tag in HTML? </title>
</head>
<body>
<h1>How to Disable a Anchor Tag in HTML? </h1>
<a href="https://www.itsolutionstuff.com" onclick="return false;">Go to ItSolutionStuff.com</a>
</body>
</html>
Example 3:
<!DOCTYPE html>
<html>
<head>
<title>How to Disable a Anchor Tag in HTML?</title>
</head>
<body>
<h1>How to Disable a Anchor Tag in HTML?</h1>
<a href="javascript:function() { return false; }">Go to ItSolutionStuff.com</a>
</body>
</html>
Example 4:
<!DOCTYPE html>
<html>
<head>
<title>How to Disable a Anchor Tag in HTML? </title>
<style type="text/css">
a[disabled="disabled"] {
pointer-events: none;
}
</style>
</head>
<body>
<h1>How to Disable a Anchor Tag in HTML? </h1>
<a href="https://www.itsolutionstuff.com" disabled="disabled">Go to ItSolutionStuff.com</a>
</body>
</html>

I’m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I’ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains:
-
DevOps School – Tech blogs and tutorials
-
Holiday Landmark – Travel stories and guides
-
Stocks Mantra – Stock market strategies and tips
-
My Medic Plus – Health and fitness guidance
-
TrueReviewNow – Honest product reviews
-
Wizbrand – SEO and digital tools for businesses
I’m also exploring the fascinating world of Quantum Computing.