javascript - SVG Clear group<g> -


suppose have svg element so

<svg id="svgcanvas" class="pan" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveaspectratio="none">     <g id="viewport">        //filled arbitrary amount of lines , cirles - examples below.       <line x1="632" y1="357.5" x2="682" y2="270.89745962155615" class="line" style="stroke: rgb(128, 128, 128); stroke-width: 1.3px;"></line>       <circle cx="82.08376766398476" cy="367.0988235405059" r="16.5" stroke="blue" fill="white" class="circle"></circle>      </g> </svg> 

how go clearing group, whilst keeping group element itself?

just using dom methods without need framework go for:

var el = document.getelementbyid("viewport"); while (el.firstchild) {     el.removechild(el.firstchild); } 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -