How Can I Remove Empty Title Tag Using Vanilla Javascript
I tried many ways to remove tag from the part of my HTML document. But nothing is worked. My intention is to remove if tag is empty. I checked few tutorials and nothing is wokre
Solution 1:
Choose all title tags in document
document.querySelectorAll("title").forEach(element => {
if (element.textContent == "") element.remove() // remove title if its empty
});
Post a Comment for "How Can I Remove Empty Title Tag Using Vanilla Javascript"