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

前端 未结 5 1625
孤街浪徒
孤街浪徒 2020-11-27 11:57

I am trying to drag and drop an image on a div. The image does not get get dragged onto the div and gives the following error

Uncaught TypeError: Failed to e         


        
5条回答
  •  伪装坚强ぢ
    2020-11-27 12:19

    In my case, there was no string on which i was calling appendChild, the object i was passing on appendChild argument was wrong, it was an array and i had pass an element object, so i used divel.appendChild(childel[0]) instead of divel.appendChild(childel) and it worked. Hope it help someone.

提交回复
热议问题