A
A
Alexey2020-05-15 20:15:07
css
Alexey, 2020-05-15 20:15:07

How to get pseudo element in js?

How can a pseudo element be accessed in JavaScript? It is not in the DOM - it turns out that in no way. But it is very necessary, I can not change the structure of the document. Some kind of crutch is needed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WapSter, 2020-05-15
@AlexR0v

There is no way to get the :before and :after pseudo-element from js. But you can change the class of their parent and, depending on this class, change the styles of pseudo-elements.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question