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

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -