Categories: Blogging

How to Disable Anchor Tag in HTML, CSS & JavaScript

Did you know that How to Disable Anchor Tag in HTML, CSS & JavaScript. This Post will give you in brief about everything on anchor tag & How to disable anchor tag. The anchor tag & the href attributes HTML uses the anchor tag to create a link to another document. Basically anchor tag is a tag which you can attach to a word or a phrase.

You are essentially creating a unique URL within the same page when you use this tag.

Today, in this post I will show you that How to Disable Anchor Tag in HTML, CSS & JavaScript. There are several ways and method to disabled the anchor tag. But these are very simple and easy methods you can try to disabling the Anchor tag.

How to Disable Anchor Tag in HTML with example

For disabling the anchor tag in the HTML, you need to follow these simple steps.

1. Open the Page’s HTML source file in text editor.

2. Locate the link you want to disable.

3. Move your cursor inside the double quotation marks in the ‘href’ section of anchor tag.

‘ Or ‘

1. First, use the HTML attribute in an anchor tag

2. For Disabling the click and add ‘disabled=’disabled’

3. This adds an instruction to anchor tag to prevent the clicking to link

Eg. :-

<html>
<head>
<title>How to Disable Anchor Tag using HTML</title>
</head>
<body>
<a href=’https://technofizi.net’ disabled=’disabled’>Click Here</a>
</body>
</html>

Related Post

NOTE* – It’s not supported by all the browsers but only supported by old browsers (Default – Internet Explorer)

How to Disable Anchor Tag in CSS

1. For disabling first use the CSS style ‘pointer-events’ to none

2. But the Mobile cursor will change as there is a link

3. To prevent this, Set the ‘cursor-default’

4. That’s it, Done

Eg. :-

<html>
<head>
<title>How to Disable Anchor Tag using CSS</title>
<style>
.not-active {
pointer-events: none;
cursor: default;
}
</style>
</head>
<body>
<a href=”https://technofizi.net” class=”not-active”>Link</a>
</body>
</html>

How to Disable Anchor Tag using JavaScript

1. First, use the JavaScript event on anchor tag i.e ‘onclick’

2. Add this event to anchor tag which you want to disable & add ‘return false’ value

3. Add this ‘return false’ value after the ‘onclick’ value

Eg. :-

<html>
<head>
<title>How to Disable Anchor Tag in JavaScript</title>
</head>
<body>
<a >
</body>
</html>

This is how you can disable the anchor tag in all the languages like HTML, CSS and JavaScript. From this your anchor tag disabled. Hope you have learned everything from it.

This post was last modified on January 21, 2016 5:49 pm

Nishant

Hey all, I am Nishant. Basically, I am the Campus Ambassador of MTV India & also Student Brand Manager at Live Restless. Stay Connected for more Updates !! & also, Check out my Social Media accounts to get connected with me on there too.

Share
Published by

Recent Posts

Best AI Tools for Summarizing PDFs: The Ones I Use In 2026

Best AI Tools for Summarizing PDFs can help you understand lengthy documents in minutes instead…

1 week ago

Live Betting vs Pre-Match Betting at World Cup 2026

The 2026 World Cup will have more matches than: an amazing 104, all crammed into…

2 weeks ago

5 Best RewritePal Alternatives in 2026 (Free + Paid Picks)

Looking for the best RewritePal alternatives in 2026? Explore the top 5 free and paid…

2 weeks ago

Best 10 Ai Cinematic Video Generator For Free Online Tool In 2026

If you are searching for the best AI Cinematic Video Generator to create viral cinematic…

1 month ago

How Car Crash Victims Can Protect Their Legal Rights Early On

The steps taken immediately after a car crash can have a lasting impact on both…

1 month ago

10 Best AI Apps Every Creator & Professional Needs on Their Phone in 2026 (Free + Paid Picks)

Over the past few days, I have been utilizing a wide array of AI tech…

1 month ago