Javascript Course 101
Get the element
document.getElementById(ID);
document.getElementByTagName(name); returns an array
o.previousSibling;
o.nextSibling;
o.parentNode;
child elements
yourElements.childNodes
yourElements.firstChild;
yourElements.lastChild;
yourElements[3];
or
yourElements.items(3);
you can chain the elements in dom to get things faster.
Node Properties
nodeName
nodeType
nodeValue
Change the node of text nodes
Check the nodeType first. for text node it should be "#text"
Attributes of element nodes
node.getAttribute(attribute)
node.setAttribute(attributename, value)
Create new nodes
newNode = node.cloneNode(bool)
document.createElement(element)
document.createTextNode(text)
Add newly created nodes to the document, otherwise the newly created node in the code won't showup in the HTML.
node.removeChild(oldNode);
node.appendChild(oldNode);
node.insertBefore(newNode, oldNode);
node.replaceChild(newNode,oldNode);