jQuery - hide redundant meta with the name attribute

0 votes
33 views
added Feb 26 in jQuery by lcjr First Warrant Officer (11,850 points)

To hide the second <meta> tag with the name attribute "description" using jQuery, you can use the following code:

$(document).ready(function(){
    $('meta[name="description"]:eq(1)').remove();
});

 

This code selects the second <meta> tag with the name attribute "description" and removes it from the DOM using jQuery's remove() function. Place this code in a <script> tag at the end of your <head> section or just before the closing </body> tag to ensure it runs after the DOM is fully loaded.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...