The methods and properties in this section exist for all DOM elements.
Method | Description |
---|
appendChild(node) | Appends a node to the element |
appendData(data) | Appends data to a node, not overwriting existing data |
blur() | Removes the focus from the element |
click() | Simulates a click on the element |
cloneNode(deep) | Creates a copy of the node (if deep is TRue, all subnodes are copied as well) |
deleteData(start, length) | Deletes a number of characters |
focus() | Gives the focus to the element |
getAttribute(attribute) | Returns the value of the given attribute |
getAttributeNode(attribute) | Returns the node containing the given attribute |
getElementsByTagName(name) | Returns an array of all elements with the given tag name |
hasChildNodes() | Whether the element has subnodes or not |
insertBefore(node) | Insert a node before the element |
insertData(position, data) | Inserts data at a certain position |
removeAttribute(attribute) | Removes the given attribute from the element |
removeChild(node) | Removes the given subnode from the element |
replaceChild(newnode, oldnode) | Replaces the given old subnode with the given new subnode |
replaceData(start, length, newdata) | Replaces data (from a given position on, with a given length) with new data |
setAttribute(name, value) | Sets the value of the given attribute to the given value |
setAttributeNode(node) | Adds a new attribute node, replacing any existing one |
Property | Description |
---|
attributes[] | List of element's attributes |
childNodes[] | List of element's subnodes |
className | Name of element's CSS class |
data | Character data (in a text node) |
dir | Reading direction of element |
firstChild | Element's first subnode |
id | ID of the element |
innerHTML | HTML content of element (not W3C-compatible, but implemented in all relevant browsers) |
lang | Language (lang attribute) of element |
lastChild | Element's last subnode |
length | Length of element |
localName | Local element name, without namespaces |
namespaceURI | URI of the element's namespace |
nextSibling | Element "next" to the current element (in the DOM tree) |
nodeName | Name of the element node |
nodeType | Type of the element node |
nodeValue | Value in the element node |
ownerDocument | The document the element resides in |
parentNode | Element's parent node |
prefix | Used prefix in node |
previousSibling | Element "before" the current element (in the DOM tree) |
style | Style information |
tabIndex | Index for tab order |
tagName | Name of element's tag |
title | Title of element |