Reputation:
Any ideas why on a website I can't get <meta>
informations ?
I'm using:
$.find("meta[name='description']").attr("content");
To get:
<meta name="description" content="My description">
Why I could not retrieve these datas ?
Any ideas ?
Thanks.
Upvotes: 0
Views: 313
Reputation: 20445
find it in head tag
$("head").find("meta[name='description']").attr("content");
Upvotes: 1
Reputation: 12508
Pass jQuery the selector directly and retrieve the value of the content
attribute like so:
$('meta[name="description"]').attr("content");
Upvotes: 2