Skip to content

Instantly share code, notes, and snippets.

@Orlandster
Created September 13, 2018 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Orlandster/07e6771b04124c356d5e451b70a37634 to your computer and use it in GitHub Desktop.
Save Orlandster/07e6771b04124c356d5e451b70a37634 to your computer and use it in GitHub Desktop.
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