Resolved: container.appendChild is not a function

In this post, we will see how to resolve container.appendChild is not a function

Question:

I am not getting the solution,please tell me the Solution of this

Best Answer:

  1. getElementsByClassName returns multiple elements. You need to use container[0] instead of container.

  2. Call appendChild method instead of appandChild.


If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com