DEV Community

Cover image for Day 21 of Leaning MERN Stack
Ali Hamza
Ali Hamza

Posted on

Day 21 of Leaning MERN Stack

Hello Dev Community! 👋

Today marks Day 21 — exactly three full weeks of documenting my journey toward mastering the MERN stack! Today, I wrapped up Lecture 7 of Apna College's JavaScript playlist with Shradha Didi, focusing on how to add and remove HTML nodes on the fly.

Up until yesterday, we could only manipulate elements that already existed in the HTML file. Today, I learned how to create components out of thin air using JavaScript!


🧠 Key Learnings From JS Lecture 7 (Part 3)

I explored the two-step process of adding new elements to the webpage layout:

1. Creating the Element

First, we must generate a new element node in the browser's memory using:


javascript
let newBtn = document.createElement("button");
newBtn.innerText = "Click Me!";
Enter fullscreen mode Exit fullscreen mode

Top comments (0)