From the course: The DOM in JavaScript, jQuery, AngularJS, and React

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

nodeType and nodeName properties

nodeType and nodeName properties

From the course: The DOM in JavaScript, jQuery, AngularJS, and React

Start my 1-month free trial

nodeType and nodeName properties

- [Instructor] I want to go over two special properties of the node class, the nodeType and nodeName. Now the nodeType is a property that represents the type of node and it returns an integer value assigned to a particular type of node. This type of node is also the read-only property, which means that you cannot change its value. Now the other one the nodeName property is one that would return the name of a current node that you're trying to select. This is also a read-only property, which means you cannot change its value. Now these two nodes are really interesting, they're really important, because sometimes you want to use them to get a certain type of node or get their values to make a certain decision based on the type of node that you want to select. Every object in the DOM is a node and so it turns out that there are about 12 different types of nodes and there used to be more, but many of them are now deprecated and they're low in use. So the question is how do you find out…

Contents