LANGUAGE » JAVASCRIPT » BROWSER

Elements

Retrieving

Property / MethodDescription
document.activeElementThe Element that currently has focus.
document.getElementById()An object reference to the identified element.
document.getElementsByClassName()A list of elements with the given class name.
document.getElementsByTagName()A list of elements with the given tag name.
document.getElementsByName()A list of elements with the given name.

Properties

PropertyDescription
Element.textContentA DOMString representing the text content of the node and its descendants.
Element.innerTextA DOMString representing the rendered text content of an element.
Element.idA DOMString representing the id of the element.
Element.tagNameA String with the name of the tag for the given element.
Element.classListA DOMTokenList containing the list of class attributes.
Element.clientHeightA Number representing the inner height of the element.
Element.scrollHeightA Number representing the scroll view height of an element.
Element.scrollTopA Number representing number of pixels the top of the document is scrolled vertically.
Element.styleA CSSStyleDeclaration representing the declarations of the element's style attribute.
Input.valueA DOMString that contains the current value of the text entered into the text field.

Methods

MethodDescription
Element.click()Click an element.
Element.getBoundingClientRect()Get size of an element and its position relative to the viewport.
Element.scrollBy()Scrolls an element by the given amount.