JavaScript Tutorial For Beginners #37 – Adding Elements to the DOM




Hey all! So for I’ve taught you how to change existing content in the DOM, but in this JavaScript tutorial I want to show you how to add new elements too!

To do this we use the createElement method, and then insert the new element into the DOM by using either one of the following methods:

appendChild(child)
insertBefore(child, element)

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


9 responses to “JavaScript Tutorial For Beginners #37 – Adding Elements to the DOM”

  1. I really liked this tutorials and ive learned so much with them! But I have a doubt… Why would I do this in JS if I could just go to HTML or CSS and edit it there? Can someone help please?

  2. Thanks so much for this video series! Quick question – why does it remove the link at the bottom and create it at the top? Surely it shuld have one at the bottom and the top? Why is the first rule being overridden?

  3. I really really really appreciate the videos. Did I say I appreciate the videos. You made every thing understandable I've watched hundreds of hours of videos on JavaScript. When I found your page last night, I knew I was on my way to fully somewhat understanding JavaScript. Thanks again. #codeForLife.

Leave a Reply