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

11th Jan 2018, 3:54 PM
Claude Dumont
Claude Dumont - avatar
3 Réponses
+ 1
Thank you, i'll try that and update the post if successful. EDIT: Changed and tried some more but still no luck. Undefined.
11th Jan 2018, 7:14 PM
Claude Dumont
Claude Dumont - avatar
+ 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/
12th Jan 2018, 6:53 AM
visph
visph - avatar
+ 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.
12th Jan 2018, 8:00 AM
Claude Dumont
Claude Dumont - avatar