Below is the table of commonly used JavaScript HTML DOM methods:
Method | Description |
getElementById | Returns the element that has the ID attribute with the specified value |
getElementsByTagName | Returns a list of elements with the specified tag name |
getElementsByClassName | Returns a list of elements with the specified class name |
querySelector | Returns the first element that matches a specified CSS selector(s) |
querySelectorAll | Returns a list of elements that match a specified CSS selector(s) |
createElement | Creates an HTML element |
createTextNode | Creates a text node |
appendChild | Adds a new child node to an element as the last child node |
insertBefore | Adds a new child node to an element before a specified child node |
replaceChild | Replaces one child node of an element with another |
removeChild | Removes a child node from an element |
setAttribute | Adds/modifies an attribute to an element |
removeAttribute | Removes an attribute from an element |
innerHTML | Gets or sets the HTML content within an element |
innerText | Gets or sets the text content within an element |