Faizan Khan’s Post

Hello everyone 👋 Welcome to Day 14 of my JavaScript journey 🚀 Today I went deeper into DOM Manipulation and learned how to create, delete, and modify elements dynamically using JavaScript. This is where webpages stop being static and start becoming interactive and dynamic 🌐 🧱 Creating & Adding Elements I practiced how to: • Create new elements using document.createElement() • Add text using innerText • Add classes using classList.add() • Insert elements into the page with appendChild() Now I can dynamically generate content instead of writing everything manually in HTML. ❌ Removing Elements I learned how to remove elements using: • .remove() (modern method) • Targeting elements like lastElementChild This showed me how UI elements can be controlled and updated in real time. 🎨 Modifying Styles & Classes Instead of only using inline styles, I learned the better approach: ✔ classList.add() ✔ classList.remove() ✔ classList.toggle() ✔ classList.contains() This is how real projects manage styling through CSS classes. 🏷 Working with Attributes I practiced: • setAttribute() and getAttribute() • Using dataset to store custom data inside elements This helped me understand how extra information can be attached to HTML elements. 🔤 Content Handling I also understood the difference between: • innerText • textContent • innerHTML This is important for controlling how text and HTML content are displayed. 🧪 Hands-On Practice To apply everything, I created a small HTML practice page and: • Dynamically added and removed elements • Changed styles using JavaScript (like document.body.style.backgroundColor ) • Toggled classes to change shapes and appearance • Tested attribute changes and data storage This practical work helped me understand how all these concepts come together in a real webpage. 🎯 Day 14 Takeaway Today made it clear how JavaScript controls the structure, style, and content of a webpage dynamically. From creating elements to modifying styles and attributes, I’m now building real interactive behavior using JavaScript 💻 Next step: DOM Events and user interaction 🚀 #javascript #dom #webdevelopment #frontenddevelopment #learninginpublic #codingjourney #developers #100daysofcode #selflearning #programming

To view or add a comment, sign in

Explore content categories