0

Question is in the description. Please answer the question.

Imagine, you have one div element in your html doc. And inside the div there are two more div elements. In other words there are one parent and two children. And I want to swap children elements. To do this I used inserBefore. The function works fine, it swaped their places. I think there must be three elements inside parent, but in fact two elements are still present. WHY???

15th Aug 2018, 11:13 AM
Timur Myngbay
Timur Myngbay - avatar
2 odpowiedzi
+ 3
How do you know they were swapped? There’s two elements because insertBefore didn’t work and probably threw an error.
15th Aug 2018, 12:03 PM
Toni Isotalo
Toni Isotalo - avatar
0
Because each child has its own color. I knew by their places or orders inside the parent.
15th Aug 2018, 12:58 PM
Timur Myngbay
Timur Myngbay - avatar