Name

HTMLElement: an element in an HTML document — DOM Level 2 HTML: Node → Element → HTMLElement

Properties

Each element of an HTML document has properties that correspond to the HTML attributes of the element. The properties supported by all HTML tags are listed here. Other properties, specific to certain kinds of HTML tags, are listed in the long table in the following Description section. HTMLElement objects inherit a number of useful standard properties from Node and Element, and also implement several nonstandard properties described here:

String className

The value of the class attribute of the element, which specifies zero or more space-separated CSS class names. Note that this property is not named “class” because that name is a reserved word in JavaScript.

CSS2Properties currentStyle

This IE-specific property represents the cascaded set of all CSS properties that apply to the element. It is an IE-only alternative to Window.getComputedStyle( ).

String dir

The value of the dir attribute of the element, which specifies the text direction for the document.

String id

The value of the id attribute. No two elements within the same document should have the same value for id.

String innerHTML

A read/write string that specifies the HTML text that is contained within the element, not including the opening and closing tags of the element itself. Querying this property returns the content of the element as a string of HTML text. Setting this property to a string of HTML text ...

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.