Featured Windows

*Latest* How To Disable Anchor Tag in HTML ?

How-to-Disable-Anchor-Tag-in-HTML
Written by Musharraf

If you have any problem in disabling HTML Anchor Tag in HTML either using HTML codes, CSS code and JavaScript Code. It is little bit easy and very useful.

First we talk little bit about CSS,HTML, Javascript and the Anchor Tag then we move to our topic.

What is CSS?

CSS is called Cascading Stylesheet which is used for giving the style into the HTML Pages. If html is laptop, CSS is the BackPack.

What is HTML? 

HTML is called Hyper Text Markup Languages which is used for creating web pages by the method of tagging the texts to achieve font, color, links, etc. to form a web page.

What is Javascript? 

If you want to create web pages more attractive and awsesome then, Javascript is the best for use. It is an Object Oriented computer programming language used to create interactive effects within web browsers.

Do not more confused Javascript with java. They are different. Javascript is a client side scripting language that works on browser.

How-to-Disable-Anchor-Tag-in-HTML

What is Anchor Tag?

Anchor Tag, <a> tag define the hyperlink which is used for linking one website from another website.

Href is an attribute of the anchor tag which is also used to identify the sections with a document. A part from href there are so many different attributes that can be used within <a> tag for various purposes.

The anatomy of <a> tag is below

<a href=”https://techsvibes.com/”>TV</a>

In this you can see that in the tag <a>, href is indicating that the link will go to https://www.techsvibes.com when the text “TV” will be clicked.

When you insert this code in a HTML Page, the output will show only the text “TV” which if you click on site link then site will be appear infront on your desktop screen.

If Text is hyperlinked then it is called anchor text and this is the text used for Anchor tag code. As we show in this example “TV” is the Anchor Text.

<a> tag is supported by almost all web browsers.

This article guide you to disable Anchor tag in CSS, HTML and Javascript.

How To Disable Anchor Tag in HTML?

If you want to disable Anchor Tag in HTML, Here is the simple code , but it is not working in present days browsers. It is only work in Internet Explorer.

<a href=”https://www.techsvibes.com”disabled= “disabled”>TV</a>

Unfortunately, In working days browsers, this code is not working. But, we have many options such as CSS and Javascript to disable the Anchor Tag.

How To Disable Anchor Tag in HTML pages using CSS.

CSS is used for grace you HTML web pages, and this is the reason of styling the web pages. Moreover, CSS can do many more.

As well as CSS can use for disabling Anchor Text.

For This, You can just use Pointer-events style, and it will be done.

I am writing an inline CSS code for the same.

<a href=”www.techsvibes.com/”style=”Pointer-events:none;cursor:default;”>TV</a>

Within the Anchor Tag I have added within “style” is the CSS code. When you add this code , the link from the text will be disabled and the text will become not clickable.

How to disable Anchor Tag in HTML pages using Javascript? 

You can disable this in HTML pages via using of Javascript as well as and it is very easy to use. You just need to use only one Javascript function.

<a href=”https://techtricksworld.com/” onclick =”return false;” >TV</a>

Hence, You done this, you can now see the link on the text but, when you click on that link, if link will not open it means now link is disabled and no link in the text.

CONCLUSION

If we create Web Pages we use HTML and CSS which are the base requirements and you can do anything with these. Disabling Anchor Tag using CSS, HTML and Javascript codes are so easy as you have read in this post.

 

2Shares

About the author

Musharraf

Hello Friends, I Am a blogger. Here you can get all the latest working internet tricks, tips for free. Here We publish top ten lists too. Keep visiting daily for exclusive tricks and online tutorials.

Leave a Comment

About TechVibes

Hello Friends, I Am blogger . Here you can get all latest apps, news and featured tips for free. Here We post top ten lists too. Keep visiting daily for exclusive featured tips and tech news for free

Dmca Protected