Chapter 13 - Javascript DOM and BOM

Please open console to see the output and visit script.js file to understand whats going on.



Javascript Dom Manupulation Demostration

Here are few exaples of DOM Manupulation -


Selecting and Replacing elements -

1) Let's select and replace a text below with getElementByID() -

Sample text 1

Sample text 2


2) Let's select and replace a text below with getElementByClassName() -

Sample text 3

Sample text 4


3) Let's select and replace a text and it's css below with querySelector() -

Sample text 5

Sample text 6


4) Let's select the items below with getElementsByName() -

Please select a subject from the above checkbox


4) Let's create elements and add them in HTML below with appendChild() -