How change content value of pseudo :before element by Javascript

后端 未结 8 777
闹比i
闹比i 2020-11-29 23:34

I have the grap constructured by CSS, which is dynamically changes by JS. I show graph max value by pseudo element as:

.graph:before {
    content:\"\"; //va         


        
8条回答
  •  情深已故
    2020-11-30 00:15

    Update (2018): as has been noted in the comments, you now can do this.

    You can't modify pseudo elements through JavaScript since they are not part of the DOM. Your best bet is to define another class in your CSS with the styles you require and then add that to the element. Since that doesn't seem to be possible from your question, perhaps you need to look at using a real DOM element instead of a pseudo one.

提交回复
热议问题