Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change content of Pseudo Element (::before, ::after) - ES6
const setPseudoElContent = (selector, value) => {
document.styleSheets[0].addRule(selector, `content: "${value}";`);
}
setPseudoElContent('.class::after', 'Hello World!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment