I'm using SVG icon in the preloader. I want to change the color of the icon's fill using a script. I have a small problem, the color changes only for a short while before closing preloader.
Here is my script:
jQuery(function($){
document.querySelector(".svgicon").getSVGDocument().getElementById("loadericon").setAttribute("fill", "#FFF");
});
And my HTML:
<object class="svgicon" type="image/svg+xml" data="'. get_template_directory_uri() . '/assets/images/preloaders/icon.svg'.'"
></object>
In the icon.svg file there is added ID "loadericon" to the HTML tag.
Can anyone help me with this?