Native JavaScript gets a simple introduction to DOM elements:
jquery can be used in various ways to get elements, such as ID selectors, class selectors, element selectors, and so on, very convenient.
Here's how to get the functionality of DOM elements using native JS implementations.
I. Get elements by ID:
The most convenient is to use the document.getElementById () function.
Refer to section document.getElementById () for details.
Two. Get elements by tag:
Use the document.getElementsByTagName () function.
Refer to the document.getElementsByTagName () section for details.
Three. Get the element through the Name property:
Use the document.getElementsByTagName () function to implement this function.
Refer to the Document.getelementsbyname () method section for details.
Four. The element is obtained through the class attribute:
Use the Getelementsbyclassname () function to implement this function.
Refer to the Getelementsbyclassname () Usage section for details.
The original address is: http://www.51texiao.cn/javascriptjiaocheng/2015/0723/7021.html
The most original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=15749
Native JavaScript gets a simple introduction to DOM elements