Example of replaceChild() method - replacing a child node

<!DOCTYPE html> <html> <body> <ul id="list1">&...

Example of hasChildNodes() method - checking for existance of a child node

<!DOCTYPE html> <html> <body> <ul id="list1"&g...

Example of document.writeIn() method

<!DOCTYPE html> <html> <body> <script> document.writel...

Opening, closing and writing to a document

<!DOCTYPE html> <html> <body> <button onclick="docO...

Example of getElementsByTagName() method - reading the elements by tag

<!DOCTYPE html> <html> <body> <ul><li>Car</l...

The nodeName and tagName properties

<!DOCTYPE html> <html> <body> <ul id="numbers"...

Creating and adding new elements

<!DOCTYPE html> <html> <style> li+li+li {font-weight:bold;...

Example with getAttribute(), setAttribute() and removeAttribute() methods

<!DOCTYPE html> <html> <body> <input type="button"...

How to add text nodes to a paragraph

<!DOCTYPE html> <html> <body> <script> //Create p...

The comment type of DOM

<!DOCTYPE html> <html> <style> span {font-size:0.8em; fon...