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);