I created a SVG out of illustrator. The elements have the fill on the paths. I am trying to change the color based on the group id that the path is in.
I would like to change all child elements fill colors in the same group to the same color when an event happens.
Here is a jsFiddle:
http://jsfiddle.net/cdcgbu6g/6/
function ChangeColor(zone,color,colorCode) {
document.getElementById(zone).children().css( "fill", colorCode );
};
The javascript would be in an external .js file.
When you click a color square, the fill value on the two objects should change that are under the group id of "Color_1".
Everything I read says this should work.
Copyright Notice:Content Author:「BrinkDaDrink」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30767314/svg-color-group-child-elements