javascript - removing child nodes within a DIV -
I want to remove ChildNodes of a DIV with a specific classname.
What would be the best possible way?
Thank you.
var myDiv = document.getElementById ('my-div'), children = myDiv ChildNodes, len = children.length, reg = / (?: \ S | ^) fooClass (?: \ S | $) /; While (lane -) {if (reg.test (children [lane] .className || '')) {myDiv.removeChild (children [lane]); }}
Comments
Post a Comment