+ 2
Why don't they work when I use the terms firstChild, lastChild, previousSibling, nextSibling when working with DOM in JavaScript
Also when working with the commands element.appendChild, element.cloneNode, these also do not run ?!
3 ответов
+ 3
No one has any idea about what you are talking but I can tell they work well on sololearn ,maybe go through JavaScript course in here
+ 2
These transversal also count space , break ,enter ,comment tabs as node.
Might you have targeted wrong. Let we have
<div>
<h1>...</h1>
<p>...</p>
</div>
Now if you target here h1 as firstChild of div it will not work because firstChild is a break/enter .
Similarly
P is not nextSibling to h1
Consider these point and try again if not work .comment and link your code here I will try for u.
0
Alireza Jamshidi
As you asked me for an examples here I have tried for you.
I hope it will be clear to you
https://code.sololearn.com/WQbFfCo1nS2C/?ref=app