Hey guys, in the last JS tutorial I showed you how to insert new HTML elements into the DOM. In this lesson, I’ll show you how to remove elements from the DOM!
We can remove elements from the DOM in JavaScript via the removeChild() method.
If you have any questions, fire away 🙂
SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
========== JavaScript for Beginners Playlist ==========
========== CSS for Beginners Playlist ==========
========== HTML for Beginners Playlist ==========
========== The Net Ninja ============
For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk
========== Social Links ==========
Twitter – @TheNetNinja – https://twitter.com/thenetninjauk
Original source
15 responses to “JavaScript Tutorial For Beginners #38 – Removing Elements from the DOM”
What about removing parent from a child?
it can't be clearer than this.
Thanks a lot!!!
Keep going Ninja
All The best ;;;;;;
What is the benefit to doing this through Javascript instead of just removing in HTML document?
Thanks! These videos are super helpful and clear.
It gets appended at bottom?
Var child =parent. getElementsByTagName("th") [0];
This statement gives error of parent. getElementsByTagName is not a function
One of the best javascript tutorial series in youtube.
When we removed the 'subject' from 'Menu', it got replaced by one more 'course' ,
why is it so?
what if i want to remove multiple div at the same time??
VM1888:1 Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
at <anonymous>:1:18. I am getting that message when i try to removeChild or even to add new <li> on the top of <ul> . What am I doing wrong ?
Are removed & child the same inside?
youtube is da real college for me
Dude your vids are awesome! Clear, clean, understandable, very good image/sound quality, easy… Just perfect! I know these vids are old but i had to say it! 🙂
nice videos my friend you deserve more than millions of subs