DOM removing element | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

DOM removing element

will this work ? why not? var parent=document.getElementById("div"); parent.removeChild(parent.childNodes[0]);

10th Dec 2017, 5:39 PM
Srivastava321
Srivastava321 - avatar
3 Answers
+ 1
try uploading a code
10th Dec 2017, 6:05 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
0
Note the difference between .childNodes and .children. .childNodes might grab white space.
10th Dec 2017, 9:28 PM
1of3
1of3 - avatar
- 1
please link your code as I don't see any obvious problem
10th Dec 2017, 5:44 PM
John Wells
John Wells - avatar