How to remove font tag which is added automatically when we translate the page with help of google translate script

69 Views Asked by At

The font tag automatically added when we translate the page with the help of google translate script.

Below image shows the original code :enter image description here

The font tag automatically added when we translate the page with the help of google translate script.

I want to remove that font tag which is added by google translate script.

Below image shows the font tag automatically added by google translate enter image description here:

1

There are 1 best solutions below

0
SandyKrish On

You can remove that font tag by using Javascript.

The script will remove all the font tags and it will remove the tag and add the content inside the tag.

function removeFontTag() { 
   const fontTags = document.querySelectorAll('font');
   console.log(fontTags);
   fontTags.forEach((font) => {
      const text = font.innerText;
      const fontParent = font.parentElement;

     font.outerHTML = text;
   });
}

removeFontTag();