logo
down
shadow

Why appendChild is not working with node type?


Why appendChild is not working with node type?

By : Sawan Choubisa
Date : November 21 2020, 11:01 PM
To fix the issue you can do getElementsByTagName returns a NodeList (Similar to an array), whereas appendChild expects its argument to be a Node.
You will need to iterate over the list yourself:
code :
var imgs = document.getElementsByTagName('img');
for( var i = 0; i < imgs.length; i++ ) {
    parent.appendChild( imgs[i] );
}


Share : facebook icon twitter icon
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'


By : Rozanne Wilsdorf
Date : March 29 2020, 07:55 AM
Any of those help The line variable you're passing isn't a Node, it's a String. Try first using
code :
var line = document.createElement("p");
line.innerHTML = "<strong>" + name + ": </strong>" + message.field_message_body.und[0].value;
document.getElementById("messages").appendChild(line);
1.js:23 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

1.js:23 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'


By : Jake Yoon
Date : March 29 2020, 07:55 AM
help you fix your problem getElementById searches the DOM tree for an element having the id you specified as parameter. In your case it is the value of input1.
So, you have to set the id of the div that you drag to the value of the input1.
code :
<div id="draggable-element" draggable="true" ondragstart="drag(event)">
ev.target.appendChild(document.getElementById('draggable-element'));
event.dataTransfer.setData("application/x-moz-node", input1);
event.dataTransfer.setData("my-draggable-id", ev.target.id);
let data = event.dataTransfer.getData("application/x-moz-node");
let draggableId= event.dataTransfer.getData("my-draggable-id");
event.target.appendChild(document.getElementById(draggableId));
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.


By : LJh
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further DHTMLX Tree has its own API to add nodes. You need not interact with HTML directly. Just use code like next
code :
//to add a new item to the tree
tree.insertNewChild(0,1,"tree")
tree.insertNewChild(1,2,"child")
//parent id, id, text
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. in Chrome

Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'. in Chrome


By : Thanh Vuong
Date : March 29 2020, 07:55 AM
I hope this helps . Chrome Gives me , A minimal XSLT 1.0 stylesheet would be
code :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
    <head>
       <title>Report</title>
    </head>        
    <body>
        <xsl:for-each select="report/titledata">
            <table width="80%" border="0">
                <tr>
                    <td width="55%" align="center">
                        <font face="tahoma">
                            <b>
                                <font size="3">Processing Log</font>
                            </b>
                        </font>
                    </td>
                    <td width="20%" align="center">
                        <font face="tahoma" size="2">
                            <b>
                                <xsl:value-of select="date"/>
                            </b>
                        </font>
                    </td>
                    <td width="25%" align="center">
                        <font face="tahoma" size="2">
                            <b>
                                <xsl:value-of select="time"/>
                            </b>
                        </font>
                    </td>
                </tr>
            </table>
        </xsl:for-each>
        <br></br>
        <div width="100%">
            <table width="95%" align="center">
                <tr>
                    <td width="45%" float="left">
                        <table>
                            <tr>
                                <td bgcolor="black">
                                    <font face="tahoma" size="1" color="white">
                                        <b>PayBank Manual Process</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>O = ON-US Files Generation</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>N = Not ON-US Files Generation</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>I = Payment Files Collection</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>R = Authorizations and Returns Collection</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>V = Verification Answer File Collection</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>G = Propietary Files Generation</b>
                                    </font>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="45%" float="right">
                        <table>
                            <tr>
                                <td bgcolor="black">
                                    <font face="tahoma" size="1" color="white">
                                        <b>PayBank Scheduler Process</b>
                                    </font>
                                </td>
                            </tr>
                            <tr>
                                <tr>
                                    <td >
                                        <font face="tahoma" size="1" >
                                            <b>P = ON-US Files Generation</b>
                                        </font>
                                    </td>
                                </tr>
                                <tr>
                                    <td >
                                        <font face="tahoma" size="1" >
                                            <b>A = Not ON-US Files Generation</b>
                                        </font>
                                    </td>
                                </tr>
                                <tr>
                                    <td >
                                        <font face="tahoma" size="1" >
                                            <b>E = Payment Files Collection</b>
                                        </font>
                                    </td>
                                </tr>
                                <tr>
                                    <td >
                                        <font face="tahoma" size="1" >
                                            <b>D = Authorizations and Returns Collection</b>
                                        </font>
                                    </td>
                                </tr>
                                <tr>
                                    <td >
                                        <font face="tahoma" size="1" >
                                            <b>L = Verification Answer File Collection</b>
                                        </font>
                                    </td>
                                </tr>
                                <tr>
                                    <td >
                                        <font face="tahoma" size="1" >
                                            <b>C = Propietary Files Generation</b>
                                        </font>
                                    </td>
                                </tr>
                                <td >
                                    <font face="tahoma" size="1" >
                                        <b>T = Automatic Return Report Generation</b>
                                    </font>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <br></br>
        <table width="100%" border="0">
            <tr bgcolor="BLACK">
                <td width="5%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>Proc</b>
                    </font>
                </td>
                <td width="15%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>Date</b>
                    </font>
                </td>
                <td width="15%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>File</b>
                    </font>
                </td>
                <td width="35%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>Error</b>
                    </font>
                </td>
                <td width="15%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>Origin</b>
                    </font>
                </td>
                <td width="8%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>Record</b>
                    </font>
                </td>
                <td width="7%" align="center">
                    <font face="tahoma" size="1" color="WHITE">
                        <b>Batch</b>
                    </font>
                </td>
            </tr>
            <xsl:for-each select="report/ProcessingLog">
                <tr>
                    <td width="5%" align="center">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="IDProcess"/>
                        </font>
                    </td>
                    <td width="15%" align="center">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="ProcTime"/>
                        </font>
                    </td>
                    <td width="15%" align="left">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="FileName"/>
                        </font>
                    </td>
                    <td width="35%" align="left">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="Message"/>
                        </font>
                    </td>
                    <td width="15%" align="left">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="OriginID"/>
                        </font>
                    </td>
                    <td width="8%" align="right">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="Record"/>
                        </font>
                    </td>
                    <td width="7%" align="right">
                        <font face="tahoma" size="1">
                            <xsl:value-of select="Batch"/>
                        </font>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </body>
</html>
</xsl:template>
</xsl:stylesheet>
function loadXMLDoc()
{
if (window.ActiveXObject)
  {
  xhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
else 
  {
  xhttp = new XMLHttpRequest();
  }
xhttp.open("GET", "http://localhost:23100/ENG_ProcessingTemplate.xsl", false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
xhttp.send("");
return xhttp.responseXML;
}
function loadXMLDoc(url)
{
if (window.ActiveXObject)
  {
  xhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
else 
  {
  xhttp = new XMLHttpRequest();
  }
xhttp.open("GET", url, false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
xhttp.send("");
return xhttp.responseXML;
}
Error message Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

Error message Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'


By : user2789529
Date : March 29 2020, 07:55 AM
will be helpful for those in need You should remove the quotes from your appendChild-calls, otherwise you pass a string to that function and it does not know how to handle that. Wihtout the quotes you pass the object-reference to the function.
code :
li.appendChild(a);
list.appendChild(li);
Related Posts Related Posts :
  • How to get my thumbnails to display in random positions (in archive page wordpress)
  • $scope methods not recognized from table AngularJS
  • Cx framework: How to access a DOM element in Cx?
  • $mdDialog could not load template with ngtemplates
  • How to fix this blank list appearing in materializecss autocomplete?(Internet Explorer)
  • Javascript : Show value behind
  • Switching from an open Bootstrap 3 dropdown menu to a different dropdown menu requires an extra tap on mobile
  • creating a circle with webgl with mouse clicks
  • firebase.database.ServerValue.TIMESTAMP return an Object
  • Matching varients and mis-spellings of a word using RegEx in MS Word
  • JS: Can a recursive function be decorated with cache?
  • How to compare pixels in Three.js
  • Non-jQuery: Getting height even if the max-height is zero
  • check count datatable is empty or not
  • Angularjs search product by price (from price to price)
  • Can't change colour of text with CSS in a table
  • Get Php variable in to Javascript function
  • fabricjs IText: overlapping character background-color making lines when semitransparent
  • Check if text is selected on keydown event
  • Angular Js ng-repeat iterating over JSON
  • Issue with socket.io updating component to show new message in chatroom
  • Vue.js: Cannot trigger ready of a component when only a param of route change
  • How do I get JSON result from controller to JavaScript
  • How to get data-src attribute with jquery?
  • JavaScript - concat two numbers and treat the result as a number
  • resizable attribute of jquery is not working
  • select random value based on condition in Jquery
  • Print another HTML page using javascript:window.print
  • Method being called before Promise is complete
  • Integrating a loader with d3.js
  • Uncaught SyntaxError: Unexpected token in Ionic
  • Executing a JavaScript file in HTML code
  • creating your own div
  • Need JS help- collapsing a toggled down element when another is selected
  • Fix the headers in html table populated by ajax
  • How to pass the value of text box and compare it to the variable.. Javascript
  • forEach works on querySelectorAll, but not getElementsByTagName?
  • why does google maps code wrapped in a div not work?
  • How to assign variable for jquery ajax post method
  • Why can't I break out of this for loop?
  • Can't add data to table with plain JS
  • How to read array object in angularjs
  • How to apply class dynamically while doing custom pagination?
  • How to get new line in node JS and passing it as JSON and saving it in a text File
  • ionic.bundle.js:25642 Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but
  • Dynamically call function in javascript
  • unknown database while running servlet code
  • JQuery hashchange event - where to place?
  • reactjs image slider navigation function, cant seem to get it working properly
  • Javascript normal Array value and Array value created by match function comparison
  • pass a value from javascript to html and codeigniter
  • how to perform div hover shows another div but both div's are different form?
  • Draw a buffer with subbuffers webgl
  • Call a function on click event in Angular 2
  • Object.assign getters and setters in constructor
  • Have to set Number of Threads, Ramp up Period and Loop count from an external properties file
  • Post data from javascript to php file using ajax doesn't work
  • How to access method in prototypal inheritance pattern?
  • Q: How do I make each div fade away individually?
  • JavaScript/jQuery: how to get HTML and display HTML, including tags
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com