Created
October 10, 2014 09:52
-
-
Save roshanca/615cb8c9532ac31bdf63 to your computer and use it in GitHub Desktop.
Get pseudo-element property with javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get the color value of .element:before | |
| var color = window.getComputedStyle( | |
| document.querySelector('.element'), ':before' | |
| ).getPropertyValue('color'); | |
| // Get the content value of .element:before | |
| var content = window.getComputedStyle( | |
| document.querySelector('.element'), ':before' | |
| ).getPropertyValue('content'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment