• Register
0 votes
567 views

Problem :

Facing following javascript issue
failed to execute 'removechild' on 'node': the node to be removed is not a child of this node.
6.9k points

1 Answer

0 votes

Solution :

I think your myCoolDiv element is not a child of the player container. It is the child of the div that you have created as a  wrapper for it Note : markerDiv in the first part of the code. That is why it is failing so removeChild only removes the children and not the descendant.

So you must remove the wrapper div.

Following is the "not adding it at all" option:

e.g.

var markerDiv = document.createElement("div");

markerDiv.innerHTML = "<div id='MyCoolDiv' style='color: #2b0808'>123</div>";

document.getElementById("playerContainer").appendChild(markerDiv.firstChild);

// -------------------------------------------------------------^^^^^^^^^^^

setTimeout(function(){

    var myCoolDiv = document.getElementById("MyCoolDiv");

    document.getElementById("playerContainer").removeChild(myCoolDiv);

}, 1500);

<div id="playerContainer"></div>

36.1k points

Related questions

0 votes
1 answer 549 views
549 views
Problem : I want to drag and drop the image on the div. The image does not get dragged onto a div and gives the below error : Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.draganddrop.html:20 dropdraganddrop.html:26 ondrop
asked Jan 18 jwilliam 3.9k points
1 vote
1 answer 251 views
251 views
Problem : Trying to drag and drop an image on a div. but the image does not get dragged on to the div and gives the following error: uncaught typeerror: failed to execute 'appendchild' on 'node': parameter 1 is not of type 'node'.
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
1 answer 143 views
143 views
Problem : I want to save my canvas to a img. I have this function: function save() { document.getElementById("canvasimg").style.border = "2px solid"; var dataURL = canvas.toDataURL(); document.getElementById("canvasimg").src = dataURL; document. ... error: Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. What should I do?
asked Nov 21, 2019 peterlaw 6.9k points
0 votes
1 answer 166 views
166 views
Problem : I am unable to solve my link problem. Can anybody help on to this to link the CSS and JS File? I am facing below error : Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/ ... .js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/prettify.js
asked Jan 10 alecxe 7.5k points
0 votes
1 answer 26 views
26 views
Problem: I am new, I need help, can anyone help? What can be used on a Linux system to trace the lineage of each child process?​
asked Feb 21 maddi86 5.4k points