JavaScript setting pointer-events
Solution 1:
Your first attempt failed because it was a CSS property and not an attribute (part of the style
attribute).
Your second attempt failed because for some off reason, when making this API casing-like-this
gets converted to camelCasingLikeThis
. This is likely because the folks who built JavaScript and the folks who built CSS weren't very well coordinated.
The following should work:
document.getElementById("div").style.pointerEvents = "none";
Solution 2:
You can access style properties via Bracket notation like this:
document.getElementById("div").style['pointer-events'] = 'auto';
No need in camel case modification in this case.