Home > Web Front-end > JS Tutorial > body text

How to get DOM elements in js

小云云
Release: 2018-03-15 15:55:11
Original
2050 people have browsed it

Document Object Model (DOM) is a standard programming interface recommended by the W3C organization for processing extensible markup languages. On a web page, the objects that organize the page (or document) are organized in a tree structure, and the standard model used to represent the objects in the document is called DOM. This article mainly shares with you how to obtain DOM elements in js.

Get by ID (getElementById)

By name attribute (getElementsByName)

By class name (getElementsByClassName)

By tag name (getElementsByTagName)

Get html (document.documentElement)

Get body (document.body)

Get a single element through the selector (querySelector)

Get a single element through the selector Group element (querySelectorAll)

Related recommendations:

Sharing of DOM knowledge points in js

Some summary of using DOM

In-depth DOM application of JavaScript

The above is the detailed content of How to get DOM elements in js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!