js node type

Solutions on MaxInterview for js node type by the best coders in the world

showing results for - "js node type"
Roberto
21 Sep 2020
1//The read-only Node.nodeType property is an integer that identifies what the node is. It distinguishes different kind of nodes from each other, such as elements, text and comments.
2
3var x = document.getElementById("ElementID").nodeType;
4
5//Returns an integer which specifies the type of the node
6/*
7Example
81.  Element
92.  Attribute
103.  Text
114.  CDATASection
125.  EntityReference
136.  Entity
147.  ProcessingInstruction
158.  Comment
169.  Document
1710. DocumentType
1811. DocumentFragment
1912. Notation 
20*/