+Get by ID: getElementById('id attribute value')
+Pass tagname: getElementsByTagName ('tagname')
+by class name: getElementsByClassName ('class name')
+through the name attribute: getElementsByName('name attribute value')
+Get the element through the selector: querySelector.
+Get a set of elements through the selector: querySelectorAll
1. Get the html element with the id value of d 1.
The resulting html elements are called DOM node objects, and parameters must be passed. The parameter is string type, which is the id of the obtained element. The return value only gets one element, and returns null if it is not found.
2. Use tagname: getElementsByTagName ('tagname')
This parameter is used to get the tagname attribute of the element, which is case-insensitive. Get html elements according to tag names and return an array (pseudo-array).
Pass the class name: getelementsbyclassname ('classname')
The parameter is the class name of the element, and the return value is an array of classes. Empty array not found.
Pass the class name: getelementsbyclassname ('classname')
You must pass a parameter, which is to get the name attribute of the element, and the return value is a class array, but no empty array is found.
Get the element through the selector: querySelector.
The parameter is a selector, and the return value only gets the first element.
Get a set of elements through the selector: querySelectorAll
The parameter is a selector and the return value is an array.