Javascript? 34
Javascript? 34
DOM
MANIPULATION IN
JAVASCRIPT
ASHFAQ AHMED
What is DOM
Accessing elements by ID
Key Points
The id must be unique on the page.
getElementById() returns the first element
with the given id.
You can then use properties like
.textContent or .innerHTML to work with
the content, or .style to change the style.
ASHFAQ AHMED
Accessing elements by
Class name
The getElementsByClassName() method
in JavaScript gives you a list of all
elements with the class name you
specify. You can access each element in
this list using a number, starting from 0.
ASHFAQ AHMED
LEARN MORE
Visit MDN Web Docs for detailed
tutorials and examples. Practice writing
loops to Visit MDN Web Docs for
detailed tutorials and examples.
Practice writing loops to enhance
coding skills and build more efficient
programs! enhance coding skills and
build more efficient programs
Save post
ASHFAQ AHMED