0

I want to handle pseudoelement ::after or ::before and animate that in JavaScript. I try to use querySelector like this

const element = doument.querySelector(".example::after")

but it return null. How can I use pseudoelement in JS?

Kloc5456
  • 37
  • 1
  • 4
  • 1
    Does this answer your question? [How to get pseudo element?](https://stackoverflow.com/questions/38872290/how-to-get-pseudo-element) – Ivar Feb 23 '21 at 16:16
  • 1
    Depending on what you're going to do with the pseudo-element, [this](https://stackoverflow.com/a/54749459/1169519) probably the best way to access pseudo-elements in JS. – Teemu Feb 23 '21 at 16:17
  • @Ivar I saw that but in this method I can get css style but I need to set style – Kloc5456 Feb 23 '21 at 16:32

0 Answers0