Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  12] [ 4]  / answers: 1 / hits: 111016  / 12 Years ago, tue, may 8, 2012, 12:00:00

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:; //value that want set by JS
position:absolute;
top:0;
left:0;
}


That's why I need to set this value by JS. I tried $(.graph:before).css(content, hh); but it didn't help. How to get that value?


More From » jquery

 Answers
124

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.


[#85717] Sunday, May 6, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kenandwightb

Total Points: 241
Total Questions: 95
Total Answers: 111

Location: Jersey
Member since Fri, Oct 1, 2021
3 Years ago
;