I am working on a custom Wordpress Theme run on my localhost server. I am having trouble figuring out why the class is being added to the classList, but the style elements are not applying.
Javascript: "custom.js"
$(document).load(function() {
changeColor();
});
function changeColor(){
var x = document.getElementById("icon").contentDocument;
var y = x.querySelectorAll("path, circle");
for(var i = 0; i < y.length; ++i) {
y[i].classList.add("icon_stroke");
}
}
External CSS Stylesheet: "style.css"
.icon_stroke {
stroke: red;
}
HTML/PHP: "front-page.php"
<object id="icon" data="<?php bloginfo('template_directory');?>/src/imgs/icons/balance_icon_light_circle.svg" type="image/svg+xml"></object>
I can see in the Chrome editor that it successfully adds the class to the classList of the SVG element, however, there is no styling change to the SVG. I assume this might have something to do with the external stylesheet interacting with an external SVG object. I have (a) attached screenshot(s) for further clarification. Please let me know if you understand what is causing this issue, or if you have a workaround solution.
Thanks!!!!