Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript and the DOM (Retiring) Making Changes to the DOM Appending Nodes

Difference between nodes and elements?

So what is the difference between nodes and elements? Guil says Nodes belong to the DOM, but elements are just plain HTML... But I still don't get it.

Any help would be appreciated!

tal Shnitzer
tal Shnitzer
Courses Plus Student 5,242 Points

thank you for asking that question. I did not understand it either

1 Answer

Steven Parker
Steven Parker
231,271 Points

Nodes are a more generic type, and all elements are nodes. There are also other kinds of nodes that are not elements, for example, a line of text on a page may exist as a text node, and while it may have a parent that is an element, it is not an element itself.

This is why "nextSibling()" might not return the same thing as "nextElementSibling()", for example.