Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript pesudo element change property values Reply To: pesudo element change property values

#266783
Shikkediel
Participant

Pseudos can be selected with JS (which I didn’t realise until shortly) but are only readable. Changing their properties isn’t possible. What you would be looking for is this:

https://developer.mozilla.org/en-US/docs/Web/API/CSSRule

Like Paulie mentioned, the script will need to use a regex and go through the entire stylesheet to find a match. Both the external accessing of the file and especially this search will certainly be a slow and “intensive” approach.

An example, I found it quite complicated:

https://codepen.io/Shikkediel/pen/QwKMBQ