Home > Article > Web Front-end > What is the html dom method? What is the use?
HTML DOM is a standard on how to obtain, change, add or delete HTML elements; and HTML DOM methods are actions that developers can perform on nodes (HTML elements) to obtain, Change, add or delete operations.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
What is HTML DOM?
HTML DOM is the standard object model and programming interface for HTML. It defines:
HTML elements as objects
Attributes of all HTML elements
Methods to access all HTML elements
Events for all HTML elements
In other words: HTML DOM is about how to get, change, add or delete HTML Element standards.
What are HTML DOM methods?
HTML DOM methods are actions we can perform on nodes (HTML elements).
Some commonly used DOM object methods:
Method | Description |
---|---|
getElementById() | Returns the element with the specified ID. |
getElementsByTagName() | Returns a node list (collection/node array) containing all elements with the specified tag name. |
getElementsByClassName() | Returns a node list containing all elements with the specified class name. |
appendChild() | Add a new child node to the specified node. |
removeChild() | Delete child nodes. |
replaceChild() | Replace child node. |
insertBefore() | Insert a new child node before the specified child node. |
createAttribute() | Create an attribute node. |
createElement() | Create element node. |
createTextNode() | Create a text node. |
getAttribute() | Returns the specified attribute value. |
setAttribute() | Set or modify the specified attribute to the specified value. |
Recommended tutorial: "html video tutorial"
The above is the detailed content of What is the html dom method? What is the use?. For more information, please follow other related articles on the PHP Chinese website!