Shawn
Shawn

Reputation: 89

How can I to remove meta tag using JavaScript?

<meta name="geo.region" content="el-gr" />

Is it possible to remove the meta tags just by using JavaScript?

Upvotes: 5

Views: 12846

Answers (1)

Atul Sharma
Atul Sharma

Reputation: 10675

Select the element & Remove it.

document.querySelector("[name='geo.region']").remove()

this will remove the first meta in the webpage with name having geo.region

Or using jQuery

$("[name='geo.region']").remove()

Upvotes: 7

Related Questions