Categories
JavaScript Answers

How to set pointer-events with JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *