Greetings fellow coder,
I'm reading a book about JS ( beginners edition ) . I am on previous and next sibling properties.
I'm a little confused. I'm trying to run this demo code:
var el = document.getElementById('two');
When I console.log(el.nextSibling);
it shows #text
.
When I use console.log(el.nextElementSibling);
it shows the correct results which is the next li
element: <li id="three" class="hot">honey</li>
In the book it's saying that using .nextSibling
will jump to the next Sibling element which it doesn't. Can someone explain me the difference?
Thank you!