Introduction to html dom nodes (nodeName, nodeValue, nodeType)

Source: Internet
Author: User

For beginners, the functions and values of the nodeName, nodeValue, and nodeType attributes in the html dom are not very clear. The information below contains detailed information about nodes for your reference.

Node Information

Each node has attributes related to certain node information. These attributes are:

  • NodeName (node name)
  • NodeValue)
  • NodeType (node type)
NodeName

The nodeName attribute contains the name of a node.

  • The nodeName of the element node is the label 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 by nodeName is always capitalized.

NodeValue

For text nodes, the nodeValue attribute contains text.

For an attribute node, the nodeValue attribute contains the attribute value.

The nodeValue attribute is unavailable for document nodes and element nodes.

NodeType

The nodeType attribute returns the node type.

The most important node types are:

Node Type
Element 1
Attribute 2
Text 3
Note 8
Document 9

 

Link to this article: details about html dom nodes (nodeName, nodeValue, nodeType)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.