Reputation: 135
<div id="chartcontainer" >
<div id="chart" style=" width : 65%; height : 65%; "></div>
<div id="curtainpie" style="color:FireBrick;">Chart is loading...</span></div>
</div>
in JS i have:
var curtain = document.getElementById("curtainpie");
curtain.parentNode.removeChild(curtain);
...........
curtain.parentNode.appendChild(curtain);
so i want to first remove the curtain then later on make it appear again but this doesnt seem to work...(i can remove the curtain but cant make it appear again)
Upvotes: 0
Views: 344
Reputation: 162
declare a parent node from curtain.
After you remove child curtain
from curtain.parentNode
, In your code,
The just below line code curtain.parentNode.appendChild(curtain);
cannot find parentNode method because no patents(you removed curtain from parent further.)
Maybe the below code will work.
var curtain = document.getElementById("curtainpie");
var parentNode = curtain.parentNode;
parentNode.removeChild(curtain);
parentNode.appendChild(curtain);
Upvotes: 1