Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript clear child elements

parent.querySelectorAll("*").forEach(child -> child.remove());

//Change the value of * if there is a specific class you want to remove 
//otherwise leave the * for removing all child elements.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #clear #child #elements
ADD COMMENT
Topic
Name
6+7 =