I have this:
<meta name="description" content="NEED_TO_UPDATE_THIS" />
<meta name="keywords" content="" />
and i need to update the content of meta tag that has the name="description" using jQuery. How can i use the selectors to choose that content atribute of that tag?
thanks
The <meta> content Attribute in HTML is used to given the values that are related to the http-equiv or name attribute. The content attribute can associated with the <meta> element. Syntax: <meta content="text"> Attribute Values: It contains single value text which is used to specify the content of the meta information.
HTML allows for the specification of meta information within META tags. A popular use of this technique involves specifying redirections or page reloads within HTML code, rather than relying on HTTP headers to do so (for example, HTTP status code 302 Document moved for redirections).
If you want to add a meta tag to your website, search for instructions about modifying the <head> of your page on your CMS (for example, search for "wix add meta tags"). Use this tag to provide a short description of the page. In some situations, this description is used in the snippet shown in search results.
$('meta[name=description]').attr('content', 'new value');
Although doing this doesn't make much sense because web crawlers which use this tag usually don't support javascript.
This will make sense when you are using phantom js and prerender the js pages for seo and proxy the bots to the pre-rendered pages instead to the live site.
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