JS native acquired DOM element method (8 types)
- Acquiring the ID (the getElementById)
- Get (getElementsByName) by the name attribute
- Get (getEleByTagName) by the tag name
- Get (getEmentsByClassName) by Class class name
- Obtaining an element (querySelector) by the selector
- Obtaining a set of elements (querySelectAll) by the selector
- Methods (document.documentElement) Gets the HTML
- The method of obtaining body (document.body): dedicated to acquiring the label body used
Get the syntax elements introduced by the selectors:
//通过选择器获取一个元素
document.querySelector(".animated");
//通过选择器获取一组元素
document.querySelectorAll(".animated");