What is the difference between node and element?

Hi, in this post I’m going to explain you which is the difference between a node and an element in the DOM.


A node is general name that is given to any type of object in the DOM. For example a node could be “document” , “document.body“, THML tags like <p></p>, <span></span>, <div></div>, <article></article>, etc. So a node is any DOM object.

There are other types of nodes like text nodes, comment nodes, document nodes, and element is just another type of node, look the next table that show us the different types of nodes:


An element is a node type called “element” so examples of elements will be: <h1></h1>, <div></div>, <section></section>, etc.

By Cristina Rojas.