question: failed to execute ‘appendChild’ on ‘node’: parameter 1 is not of type ‘node’
reason: the parameter of appendChild is node. This problem indicates that the current parameter is not node, it may be a string
For example:
DOM is a string
solution:
var dom=document.createElement('p');
dom.className='book';
dom.innerHTML='hello world';
document.body.appendChild(dom);
In this case, DOM is node
If the added element is a string, use document. Createtextnode() to create the node
var dom=document.createTextNode('hello world');
Similar Posts:
- [Solved] DOM Add Element to HTML Error: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’
- [Solved] WebGL Error: uncaught referenceerror unitymodule is not defined
- SyntaxError: missing ; Problem record of before statement
- Difference between normalize space (.) and normalize space (text ()) in XPath
- How to Solve Error: Cannot set property ‘onclick’ of null
- document.body.scrollTop or document.documentElement.scrollTop
- JavaScript Uncaught TypeError: Cannot set property ‘innerHTML’ of null”
- Uncaught typeerror: cannot read property ‘appendChild’ of null? report errors
- [Solved] Exception in thread “main” java.util.ConcurrentModificationException
- [How to Solve] Cannot set property ‘onclick’ of null