Gabriele Ferro Home

DOM Manipulation

Day6: 12 july 2020

**Today’s Progress:**

What is the DOM?

Searches from an element

Modify the DOM

Modify classes (examples)

Change the style of an element (examples)

Modify attributes (with examples)

element.setAttribute( <name>, <values> );

element.removeAttribute( <attributeName> );

Create a new element

document.createElement( <tag> );

Add children

parentNode.appenChild( <element> );

Remove and Replace Items


Javascript code that creates a paragraph, then it assigns a class and changes the color. The paragraph is then inserted inside the element with the id "main".
Javascript code that creates a paragraph with content, then it assigns a class and changes the color. Finally, the paragraph is inserted inside the element with the id "main".

**Thoughts:**

I am so shocked and happy at the same time because my previous knowledge in JavaScript ( 2006 ) is still valid!

This page will be handy in the future as a memory helper and a quick reminder.

**Link to tweet:**

February 2024
MTWTFSS
 1234
567891011
12131415161718
19202122232425
26272829 

Archives

Gabriele Ferro Home
Copyright © Ferro Gabriele. All rights reserved.