DOM methods

The DOM is not part of the JavaScript language, but is instead a Web API used to build websites.The DOM is not part of the JavaScript language, but is instead a Web API used to build websites.

getElementById

The Documentarrow-up-right method getElementById() returns an Elementarrow-up-right object representing the element whose idarrow-up-right property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly.

getElementsByTagName

The getElementsByTagName method of Documentarrow-up-right interface returns an HTMLCollectionarrow-up-right of elements with the given tag name.

querySelector

The Documentarrow-up-right method querySelector() returns the first Elementarrow-up-right within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned.

querySelectorAll

The Documentarrow-up-right method querySelectorAll() returns a static (not live) NodeListarrow-up-right representing a list of the document's elements that match the specified group of selectors.

References

Last updated

Was this helpful?