Home > Web Front-end > JS Tutorial > JS nodeType return type

JS nodeType return type

高洛峰
Release: 2016-10-13 14:35:08
Original
1149 people have browsed it

Record several commonly used attributes in HTML DOM:

nodeName, nodeValue and nodeType contain information about nodes.
nodeName attribute contains the name of a node.

The nodeName of the element node is the tag name
The nodeName of the attribute node is the attribute name
The nodeName of the text node is always #text
The nodeName of the document node is always #document
Note: The tag name of the XML element contained in nodeName is always uppercase The

nodeValue
For text nodes, the nodeValue property contains the text.

For attribute nodes, the nodeValue attribute contains the attribute value.

nodeValue property is not available for document nodes and element nodes. The

nodeType
nodeType property returns the type of node.

The most important node types are:

Element type==》Node type
Element ==》1
Attribute attr ==》2
Text ==》3
Comments ==》8
Document document = =》9


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template