JSFiddle - React, Tailwind, and code Playground
HTML
<div id="parent-1">
<div id="child"></div>
</div>
<div id="parent-2"></div>
CSS
#parent-1,#parent-2 {
height: 100px;
width: 100px;
background-color: grey;
margin: 10px;
}
#child {
height: 20px;
width: 20px;
background-color: black;
}
JavaScript
var parent1 = document.getElementById('parent-1'),
parent2 = document.getElementById('parent-2'),
child = document.getElementById('child');
parent1.appendChild(child);
console.log(child.parentNode === parent1); //true
setTimeout(function() {
parent2.appendChild(child);
console.log(child.parentNode === parent1); //false
}, 500);