Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pointer-events: none not working in IE

I'm trying to disable the hyperlinks in my SharePoint 2013 list edit page. I used a content editor webpart and put pointer-events : none. It works fine on Google Chrome but doesn't work in IE . Is there any alternative to this? I just want the CSS alternative. My IE is version 10.

like image 937
Revenant_01 Avatar asked Mar 09 '16 07:03

Revenant_01


People also ask

What does pointer events do?

Pointer events are DOM events that are fired for a pointing device. They are designed to create a single DOM event model to handle pointing input devices such as a mouse, pen/stylus or touch (such as one or more fingers). The pointer is a hardware-agnostic device that can target a specific set of screen coordinates.

What is pointer events in CSS?

The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events.


1 Answers

pointer-events is not supported in IE 10 and there is no other similar CSS property.

Either a change in your markup or using a script is needed to solve that.

Update

Here is a sample using script.

I also styled the link so one can't see them as links, which actually could be used alone, based on if someone randomly clicks in the text and accidentally hits one, it would still be okay.

Array.prototype.slice.call(document.querySelectorAll("a")).forEach(function(link) {
  link.addEventListener("click", function(e) {  
    e.preventDefault();
  });
});
a {
  cursor: text;
  text-decoration: none;
  color: inherit;
}
Some text with <a href="http://stackoverflow.com"> a link </a> to click on

Update 2

Here is actually 2 posts that has a several ways of how this might be done (all script though but one),

  • css 'pointer-events' property alternative for IE
  • How to make Internet Explorer emulate pointer-events:none?

where this answer doesn't use script.


Update 3 based on comment

To use the attribute disabled='disabled' one either need to add it server side so the anchor looks like this, <a href="link" disabled="disabled">Link</a>, or client side with a script like this

Array.prototype.slice.call(document.querySelectorAll("a")).forEach(function(link) {

  link.setAttribute('disabled', 'disabled');

});
/*
a {
  cursor: text;
  text-decoration: none;
  color: inherit;
}
*/
Some text with <a href="http://stackoverflow.com"> a link </a> to click on
like image 126
Asons Avatar answered Nov 15 '22 05:11

Asons