JavaScript setting pointer-events

前端 未结 3 893
半阙折子戏
半阙折子戏 2021-02-03 17:05

I am trying to set pointer-events: none for a div through JavaScript, however the property is not being applied.

I have tried:

document.getE         


        
3条回答
  •  不思量自难忘°
    2021-02-03 17:49

    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.

提交回复
热议问题