Skip to content
Advertisement

” Failed to execute ‘removeChild’ on ‘Node’: parameter 1 is not of type ‘Node’ ” javascript

I have this error showing on my console although everything is working fine, I have divs of books name, and beside them a button “delete. at the bottom I have a form with the button “add”, I am trying to add and delete books according to event “click” and it works fine, but I’m wondering what this error means? “script.js:9 Uncaught TypeError: Failed to execute ‘removeChild’ on ‘Node’: parameter 1 is not of type ‘Node’. at HTMLDivElement. (script.js:9)”

here is my code

Advertisement

Answer

Try switching around the .removeChild() function like below:

JavaScript

Another approach is to delete the bookdiv.

JavaScript
Advertisement