• Register
0 votes
1.2k 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 5 3
6,930 points

Please log in or register to answer this question.

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>

9 7 4
38,600 points

Related questions

0 votes
1 answer 1.3K views
1.3K 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, 2020 jwilliam 3.9k points
1 vote
1 answer 692 views
692 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 332 views
332 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 47 views
47 views
I'm trying to render html files, but I'm having an issue. This works. app.get('/randomlink', function(req, res) { res.sendFile( __dirname + "/views/" + "test2.html" ); }); But I don't want to copy and paste dirname thingy over and over, so I tried this ... // test2.html exists in the views folder }); Here's the error. path must be absolute or specify root to res.sendFile Please help me solve this.
asked Jan 23 khaled 280 points
0 votes
1 answer 56 views
56 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, 2020 maddi86 5.4k points
0 votes
1 answer 13 views
13 views
Problem: When I try to upgrade my database from Mvc-AngularJs to wcf-Rest, I get an error like Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9706/EmployeeService.svc/UpdatexyzData/Update/but with the same ur when I try to get ... : { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded ;charset=utf-8' } }) return ss; }
asked Jan 24 sasha 8.4k points
0 votes
1 answer 438 views
438 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, 2020 alecxe 7.5k points