Premium Only Content

DOM Tutorial | Dom Manipulation in HTML| Day 37 | Part - 1 | Web development Course 2023
DOM Manipulation
DOM Manipulation refers to the process of dynamically changing the content, structure, and style of a web page after it has loaded. This is done by accessing and manipulating the Document Object Model (DOM), which is a tree-like representation of the HTML document.
There are several ways to manipulate the DOM in JavaScript:
1. Accessing DOM elements:
getElementById: Retrieves an element by its unique ID.
getElementsByClassName: Retrieves a collection of elements by their class name.
getElementsByTagName: Retrieves a collection of elements by their tag name.
querySelector: Retrieves the first element that matches a CSS selector.
querySelectorAll: Retrieves a collection of elements that match a CSS selector.
2. Modifying content:
textContent: Sets or gets the text content of an element.
innerHTML: Sets or gets the HTML content of an element.
innerText: Sets or gets the inner text of an element (including any child elements).
3. Modifying attributes:
setAttribute: Sets an attribute on an element.
getAttribute: Gets the value of an attribute on an element.
removeAttribute: Removes an attribute from an element.
4. Adding and removing elements:
appendChild: Adds a child element to the end of another element.
insertBefore: Adds a child element before another child element.
removeChild: Removes a child element from its parent element.
5. Modifying styles:
style.setProperty: Sets the value of a specific style property.
classList.add: Adds a class name to an element.
classList.remove: Removes a class name from an element.
-
2:02:18
Side Scrollers Podcast
18 hours agoVShojo COLLAPSES, Unhinged CELEBRATE Hulk Hogan’s Death, Chuck E Cheese ARRESTED | Side Scrollers
6.08K2 -
25:49
GritsGG
9 hours agoRank 1 Player Crushes Solo Lobby!
6.8K2 -
35:14
The Pascal Show
10 hours ago $1.36 earnedHE'S GONNA SUE COLDPLAY?! Astronomer HR Resigns & Ex-CEO Set To Sue Coldplay Over Kiss Cam Drama
4.08K3 -
LIVE
Lofi Girl
2 years agoSynthwave Radio 🌌 - beats to chill/game to
485 watching -
19:18
DeVory Darkins
6 hours ago $23.55 earnedDemocrat non-profit SCAM EXPOSED as Trump OBLITERATES Newsom
35K70 -
23:58
Stephen Gardner
8 hours ago🔥Obama THROWS Adam Schiff under the bus to obstruct Trump!
27.6K108 -
38:44
The Why Files
4 days agoProject Ancient Arrow | The NSA's Secret War Against Our Future
63K73 -
2:36:06
Barry Cunningham
9 hours agoPRESIDENT TRUMP IS TRULY USHERING IN THE GOLDEN AGE OF AMERICA! CAN YOU FEEL IT?
114K44 -
3:47:25
SynthTrax & DJ Cheezus Livestreams
3 days agoFriday Night Synthwave 80s 90s Electronica and more DJ MIX Livestream 2K Celebration SPECIAL EDITION 530pm PST / 830pm EST
55.7K5 -
2:21:54
VapinGamers
6 hours ago $3.67 earnedDestiny 2 - Edge of Fate Legendary Run Part 3 - !rumbot !music
31K