& lt/div & gt;& lt script & gt//Through DOM tags, all DIV tags on the page will be selected.var? divObj? =? docum" />
Current location - Quotes Website - Signature design - Analysis of several methods for JS to obtain HTML elements in web pages
Analysis of several methods for JS to obtain HTML elements in web pages
Commonly used methods are as follows:

& ltdiv? id="mued "? class="mued " >& lt/div & gt;

& lt script & gt

//Through DOM tags, all DIV tags on the page will be selected.

var? divObj? =? document . getelementsbytagnames(" div ");

//Obtained by ID, unique.

var? divObjId? =? document . getelementsbyid(" mued ");

//Obtained through Class will select all DOM tags with a class named mued on the page.

var? divObjClass? =? document . getelementsbyclassname(" mued ");

//If you use the jQuery library, it will be easier.

var? jDiv? =? $(" div ");

var? jDivId? =? $(" # mued ");

var? jDivClass? =? $(".mued”);

& lt/script & gt;