HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Access to HTML DOM - find HTML elements.
Access HTML elements equivalent to Access Node
You can be in a different way to access HTML elements:
getElementById () method returns the element with the specified ID:
The following example Get id = "intro" element:
getElementsByTagName () returns all elements with the specified tag name.
The following example returns a list of documents that contain all the <p> element:
The following example returns a list of documents that contain all the <p> element, and the <p> element should be a descendant id = "main" element (child, Sun, etc.):
If you want to find all HTML elements with the same class name, use this method:
Returns a list containing the above example class = "intro" all the elements:
Note: getElementsByClassName () is not valid in 5,6,7,8 in Internet Explorer.