Failed to execute removeChild on Node

后端 未结 5 1726
盖世英雄少女心
盖世英雄少女心 2021-02-02 06:22

Other stack answers such as this and this seem to be specialized cases and I believe my case is more generalized. I am doing this in my js:

var markerDiv = docum         


        
5条回答
  •  悲&欢浪女
    2021-02-02 07:00

    As others have mentioned, myCoolDiv is a child of markerDiv not playerContainer. If you want to remove myCoolDiv but keep markerDiv for some reason you can do the following

    myCoolDiv.parentNode.removeChild(myCoolDiv);
    

    JSFiddle

提交回复
热议问题