Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Trick to change svg fill color
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
You can’t perform that action at this time.