Hackforge Academy

Category: javascript

DOM manipulation

Published on 16 Jul 2026

Explanation

DOM manipulation changes HTML content dynamically.

Code:

document.getElementById('msg').textContent = 'Hello';

Explanation

HTML content can be updated using innerHTML.

Code:

document.getElementById('box').innerHTML = '<b>Hi</b>';

Explanation

CSS styles can be changed using JavaScript.

Code:

document.getElementById('box').style.color = 'red';

Explanation

New elements can be created and added to the page.

Code:

const p = document.createElement('p');
p.textContent = 'New Paragraph';

Explanation

Elements can also be removed from the DOM.

Code:

document.getElementById('box').remove();

๐Ÿš€ Learn Spring Boot with real-world projects

๐Ÿ’ก Build REST APIs step by step

๐Ÿง  Improve backend development skills

๐ŸŽฏ Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

๐Ÿ

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
โš›๏ธ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
โ˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community