Reputation: 648
First of all, I'm very new with all that JavaScript stuff. I'm using parentNode.remove() to close a modal box on my site. Works perfectly in Firefox and Chrome, but nothing in IE (8-9-10-11...).
The link that I use to close the box looks like this:
<a onClick="parentNode.remove()" class="close">X</a>
Is there a way that I can tweak my onclick to work in Internet Explorer?
Thanks a lot!
Upvotes: 0
Views: 1156
Reputation: 1814
remove();
is a jQuery method. Are you using jQuery? If so, you could do: $(this).parent().remove();
.
I don't know if this is just an example, but I would recommend creating a single function instead of adding individually.
$('a').on('click', function (e) {
e.preventDefault();
$(this).parent.remove();
});
Upvotes: 1