HTML DOM Document Object In JavaScript

The owner of all other objects in your web page is HTML DOM document object. It represents web pages. If you want to access html element you have start accessing with document object.

Finding HTML Elements

Method Description
document.getElementById(id) Find an element by element id
document.getElementsByTagName(name) Find elements by tag name
document.getElementsByClassName(name) Find elements by class name

Changing HTML Elements

Method Description
element.innerHTML =  new html content Change the inner HTML of an element
element.attribute = new value Change the attribute value of an HTML element
element.setAttribute(attribute, value) Change the attribute value of an HTML element = new style Change the style of an HTML element


Pankaj Singh Sugara