Differences between nodeName, nodeValue, nodeType, and typeof _ javascript skills

Source: Internet
Author: User
Tags processing instruction
This article briefly introduces the differences among nodeName, nodeValue, nodeType, and typeof, which is a small summary of knowledge points and hopes to help our friends. 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

NodeValue node value

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.

The nodeType attribute returns the node type.

The most important node types are:

Element element1 attribute attr2 text text3 annotation comments8 document document9 supplement:

Value-element type

1-ELEMENT

2-ATTRIBUTE

3-TEXT

4-CDATA

5-ENTITY REFERENCE

6-ENTITY

7-PI (processing instruction)

8-COMMENT

9-DOCUMENT

10-DOCUMENT TYPE

11-DOCUMENT FRAGMENT

12-NOTATION

Typeof

Returns a string representing the expression data type. possible strings include: "number", "string", "boolean", "object", "function", and "undefined"

The above is all the content in this article. if you have a new understanding of these four knowledge points, please leave a message if you have any questions.

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.