I have this code:
document.getElementById(id).remove();
But, IE give me an error with this function. Do you know an other way for make this remove?
Use the pollyfill from MDN
if (!('remove' in Element.prototype)) {
Element.prototype.remove = function() {
if (this.parentNode) {
this.parentNode.removeChild(this);
}
};
}
Use this code instead:
var child = document.getElementById(id);
child.parentNode.removeChild(child);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With