0
How to target "::after" in JS? Am I blind? What do I miss?
I'm trying to target the "::after" of an element but everything I try fails. What am I missing or can't this be done? var navigation = document.getElementById("s5_left_column_wrap"); var lastchild = navigation.lastChild; https://code.sololearn.com/WcL4TOM96HcZ
3 ответов
+ 1
Thank you, i'll try that and update the post if successful.
EDIT: Changed and tried some more but still no luck. Undefined.
+ 1
::after (and ::before) are called "pseudo-elements": they are unreachable through Javascript or even through the 'style' inline attribute, unfortunally, but quite logically ;) (behind the scene, they are not part of the DOM -- Document Object Model)
Anyway, there are some tricky workarounds:
http://pankajparashar.com/posts/modify-pseudo-elements-css/
+ 1
Thank you visph. Inspectors (FF & Chrome) show a lot Information about the pseudos but a small script to log all of the body's child elements did not reveal the pseudos. best regards, C.