The HTMLElement Members
HTMLElement object represents the HTML elements in the document.
Name | Description | Returns |
---|---|---|
add(<class>) | Adds the class to the element. | void |
appendChild(HTMLElement) | Appends the specified element as a child of the current element. | HTMLElement |
attributes | Returns the attributes applied to the element. | Attr[] |
checked | Gets or sets the presence of the checked attribute. | boolean |
classList | Gets or sets the list of classes. | DOMTokenList |
className | Gets or sets the list of classes. | string |
cloneNode(boolean) | Copies an element. | HTMLElement |
compareDocumentPosition(HTMLElement) | Determines the relative position of an element. | number |
contains(<class>) | Returns true if the element belongs to the specified class. | boolean |
createElement(<tag>) | Creates a new HTMLElement object with the specified tag type. | HTMLElement |
createTextNode(<text>) | Creates a new Text object with the specified content. | Text |
dataset | Returns the data-* attributes. | string[<name>] |
dir | Gets or sets the dir attribute. | string |
disabled | Gets or sets the disabled attribute. | boolean |
getAttribute(<name>) | Returns the value of the specified attribute. | string |
hasAttribute(<name>) | Returns true if the element has the specified attribute. | boolean |
hidden | Gets or sets the hidden attribute. | boolean |
id | Gets or sets the id. | string |
innerHTML | Gets or sets the element's content. | string |
insertAdjacentHTML(<pos>, <text>) | Inserts HTML relative to the element. | void |
insertBefore(<newelem>, <childElem>) | Inserts the first element before the second (child) element. | HTMLElement |
isEqualNode(<HTMLElement>) | Determines whether the specified element is equal to the current element. | boolean |
isSameNode(HTMLElement) | Determines whether the specified element is the same as the current element. | boolean |
lang | Gets or sets the lang attribute. | string |
length | Returns the number of classes to which the element belongs. | number |
outerHTML | Gets or sets an element's HTML and contents. | string |
remove(<class>) | Removes the class. | boid |
removeAttribute(<name>) | Removes the specified attribute from the element. | void |
removeChild(HTMLElement) | Removes the specified child of the current element. | HTMLElement |
replaceChild(HTMLElement, HTMLElement) | Replaces a child of the current element. | HTMLElement |
setAttribute(<name>, <value>) | Applies an attribute with the specified name and value. | void |
spellcheck | Gets or sets the spellcheck attribute. | boolean |
style | the style of the element | CSSStyleDeclaration |
tabIndex | Gets or sets the value of the tabindex attribute. | number |
tagName | Returns the tag name indicating the element type. | string |
title | Gets or sets the title attribute. | string |
toggle(<class>) | Adds the class if it is not present, and removes it if it is present. | boolean |
Home
JavaScript Book
DOM
JavaScript Book
DOM
HTMLElement:
- The HTMLElement Members
- element tag name, id, direction, language, hidden disabled information
- addEventListener
- appendChild
- attributes returns a collection containing all of the attributes
- classList
- className
- cloneNode
- createElement
- createTextNode
- dataset
- getAttribute
- getElementsByTagName
- hasAttribute
- innerHTML
- insertAdjacentHTML
- insertBefore
- isSameNode
- outerHTML
- onmouseout
- onmouseover
- querySelectorAll
- removeEventListener