how to get child tags using each statement?

HTML

<svg id="svgcontent" >
    <g id="layer" class="layer" > </g>
    <g id="test1" > </g>
    <g id="test2"></g>
    <g id="test2"> </g>
<span>

JavaScript

$('#svgcontent g').each(function () {                                  
    if($(this).hasClass('layer')) {
        $(this).remove();
    }
});

Leave a Comment