3
'Node'で 'removeChild'を実行できませんでした:削除するノードは で、このノードの子ではありません。Uncaught DOMException: 'Node'で 'removeChild'を実行できませんでした。
以下のコードを実行するとエラーが発生します。この問題を解決する方法はありますか?
function clickLinks(links) {
for(var item in links) {
var anchor = document.createElement("a");
anchor.target = "_blank";
anchor.href = links[item];
document.body.appendChild(anchor);
window.setTimeout(function() {
anchor.dispatchEvent(new MouseEvent("click",{
"bubbles" : true,
"cancelable" : true,
"view" : window
}));
window.setTimeout(function() {
document.body.removeChild(anchor);
}, 50);
}, 50);
}
}