Object element has no 'append' method error. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Object element has no 'append' method error.

I'm using an android phone running Android 4.4 Kitkat and it throws the above error on running the code below. This code works fine on my PC and on my other phone running Android 7.0 Nougat. Is the error because of the android version? Actual error reads "Uncaught TypeError: Object#<HTMLBodyElement> has no method 'append' Line 3848" (The code is only 6 lines long so I'm thinking server side code, or the solo learn browser code?) https://code.sololearn.com/WQ43hl95WSq5/#html

26th Jan 2018, 7:00 AM
Nick Nderitu
Nick Nderitu - avatar
2 Answers
+ 7
It's your device. The error is coming from Jquery library. Use a web browser like firefox or chrome. it will work fine on that device. on android 5.1 and higher on latest web view update it runs error free Just for testing run the below code and see if there is any error <body id = "container"> Content to be added here </body> <script> this.onload = function() { var p = document.createElement("p"); var node = document.createTextNode("I'm adding myself to the container"); p.appendChild(node); document.getElementById("container").append(p); }; </script>
26th Jan 2018, 7:07 AM
Lord Krishna
Lord Krishna - avatar
+ 1
Similar error. I wonder why android 4.4 doesn't work. It does work on chrome browser though. Thanks
26th Jan 2018, 7:21 AM
Nick Nderitu
Nick Nderitu - avatar