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

Grok AI Image Generator – How to Use Grok AI, Image Prompt

Grok AI Image Generator 2025: Do you also want to create an image like the…

2 weeks ago

25+ Best Free AI Maker Tools In 2025

Are you looking for the greatest free AI Maker tools to grow your business? This…

1 month ago

10 Ai Kiss & Hug Video Generator For Free Online Tool In 2025

Hello friends, are you also searching for a tool or website to make AI kissing…

1 month ago

Trending 5 AI Clothes Changer Online Free Tool In 2025

Do you love experimenting with different outfits, AI Clothes Changer or find buying new clothes…

1 month ago

A World of Luxury: Exploring the Perks of Premium Credit Cards

Premium credit cards offer many special benefits to the user. These can enhance a person’s…

2 months ago

A Buyer’s Guide to 45ft Standard Shipping Containers in the United States

Shipping containers are among the most versatile and durable storage solutions available, commonly used for…

2 months ago