How to get the type of node

Available through Node.prototype.nodeType property. 

document.nodeType; // 9

9 indicates that the node is a document node (Document), seven kinds of node type of correspondence is as follows: 

 

The main role is to determine the type of node.

document.nodeType === Node.DOCUMENT_NODE; // true
Node.DOCUMENT_NODE; // 9

 

Guess you like

Origin www.cnblogs.com/aisowe/p/11495383.html
Recommended