Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable html anchor in Internet Explorer

I am getting a problem in my application, where i want to disable html anchor with css, I have seen a solution in Disable link using css, which is working fine in Chrome and Firefox, but when i am opening my page to Internet Explorer, It could not be disabling, I have gone through many links but i didn't get any solution for internet explorer, Please help me if you have any helpful link or answer. Thanks in advance

http://jsfiddle.net/7EQJp/

<a href="link.html" class="active">Link</a>

.active {
       pointer-events: none;
       cursor: default;
} 
like image 436
Praveen Rawat Avatar asked Oct 09 '15 12:10

Praveen Rawat


2 Answers

You can use pointer-events css property to disable the links but they have known issues with ie. Starting from ie 11 this property is supported. There is a little hack. You should add disabled class to links and add disabled attribute to the link then add css that is given below. Also you need to provide pointer-events none for disabled anchor attribute. After these two this should work in most browsers.

a.disabled {
    pointer-events: none;
}

a[disabled] {
    pointer-events: none;
}

See this fiddle.

like image 196
Rahul Singh Avatar answered Nov 05 '22 09:11

Rahul Singh


CSS way to disable links:

a[disabled]{
pointer-events: none;}

else you can use javascript to disable links:

$("td > a").attr("disabled", "disabled");
like image 29
Nikson K John Avatar answered Nov 05 '22 09:11

Nikson K John