Created
September 27, 2017 15:17
-
-
Save samnajian/09ddf340175d3721c24cc297efe0c375 to your computer and use it in GitHub Desktop.
Trick to change svg fill color
This file contains 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
document.addEventListener('DOMContentLoaded', function() { | |
/** | |
* Refrence to object element that has svg as data attribute | |
**/ | |
const obj = document.querySelector('object'); | |
const svg = obj.contentDocument.querySelector("svg"); | |
svg.style.fill = "red" // change fill color to red | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment