Is there any way to disable a link using CSS?
I have a class called current-page
and want links with this class to be disabled so that no action occurs when they are clicked.
Is there any way to disable a link using CSS?
I have a class called current-page
and want links with this class to be disabled so that no action occurs when they are clicked.
Bootstrap Disabled Link
Bootstrap Disabled Button but it looks like link
Thanks to everyone that posted solutions, I combined multiple approaches to provide some more advanced
disabled
functionality. Here is a gist, and the code is below.Here is the coffescript class:
you can use this css:
You can also size another element so that it covers the links (using the right z-index): That will "eat" the clicks.
(We discovered this by accident because we had an issue with suddenly inactive links due to "responsive" design causing a H2 to cover them when the browser window was mobile-sized.)
I searched over internet and found no better than this. Basically to disable button click functionality, just add CSS style using jQuery like so:
Then to enable it again do this
Checked on Firefox and IE 11, it worked.
It's possible to do it in CSS
See at:
Please note that the
text-decoration: none;
andcolor: black;
is not needed but it makes the link look more like plain text.