Sometimes, we want to set pointer-events with JavaScript.
In this article, we’ll look at how to set pointer-events with JavaScript.
How to set pointer-events with JavaScript?
To set pointer-events with JavaScript, we set the the style
property value.
For instance, we write
document.getElementById("div").style["pointer-events"] = "auto";
to select the element with getElementById
.
Then we set the style["pointer-events"]
property toi set the pointer-events
CSS property to 'auto'
.
Conclusion
To set pointer-events with JavaScript, we set the the style
property value.