I'm trying to remove css file from document.
ths should work.. ==>
document.getElementsByTagName("link")[1].remove();
but, not working. and when I add some testing code. ==>
document.getElementsByTagName("link")[1].remove();
console.log(document.getElementsByTagName("link")[1].remove());
it's working now.
what is the problem.. or what do I miss ?
Remove is not a DOM node method. Maybe you confused it with the jQuery method?
Either use plain JavaScript:
var linkNode = document.getElementsByTagName('link')[1];
linkNode.parentNode.removeChild(linkNode);
Or jQuery:
$('link').eq(1).remove();
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