12

How to use the disabled attribute for a tag in HTML

I have tried this

<a href="#" disabled>
    My Link
</a>
Sameer Basil
  • 366
  • 5
  • 11
Vishu
  • 183
  • 1
  • 1
  • 5
  • My Link – Vishu Apr 19 '17 at 10:14
  • Clearly an duplicate of [http://stackoverflow.com/questions/7654900/how-do-you-make-an-anchor-link-non-clickable-or-disabled#], [http://stackoverflow.com/questions/10276133/how-to-disable-html-links/10276157#10276157] –  Apr 19 '17 at 10:21

4 Answers4

36

a.disabled {
    pointer-events: none;
    color: #ccc;
}
<a href="www.google.com" class="disabled">Click me</a>

Please check the above code. It may help you out.

9

There is no disabled attribute like this(<a href="#" disabled>) for "a" tag. you can try disabling using css so just add class in your "a" tag & then disable using css.

<a href="#" class="disable">
    My Link
</a>
.disable {
   pointer-events: none;
   cursor: default;
}
8

There is no disabled attribute for <a> tag. Look here

Kas Elvirov
  • 7,394
  • 4
  • 40
  • 62
0

You can try the code below:-

<style>
.disabled{
    /*Disabled link style*/
    color:black;
}
</style>

<a class="disabled" href="javascript:void(0)">LINK</a>
Webdev
  • 617
  • 6
  • 24