I am working with SVG <g>
tags using JavaScript. I need get the inner tags (eg: rect
, path
, etc) in each of the <g>
tags.
This is what I used to get a particular tag.
var stess = selectedElement.getElementsByTagName('rect');
console.log(stess);
But I have dynamic tags as well. how should I retrieve the values of the inner tags? More so, how could I change the width of these inner tags?
Here is the code that I tried:
$('.test').change(function() {
console.log(selectedElement.children()); // Results Error
}
I end up logging <g id=xxx fill-opacity=1 stroke-opacity=1><rect></g>
. How should I proceed?