Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’

Illustration without a description Illustration without a description

appendChild() expects a DOM node. An HTML string, plain data object or framework component descriptor cannot be appended as if it were an element. Pause before the call and inspect the argument, especially when it came from a helper that renders or describes markup.

 

Create an element with DOM APIs and set its text or attributes before appending it. Use a text node for plain text. When a framework owns the target, update the state that drives its render so it can create and manage the node.

 

const target = document.querySelector('#list'); const item = document.createElement('li'); item.textContent = 'Ready'; target?.appendChild(item); // appendChild requires a Node

 

Verify that the parent lookup found the intended target as well. Fixing the argument type is only one part of putting the new node where the interface expects it.

 

Inspect the first appendChild argument, then repeat the operation with a real element or text node.