user4099673
user4099673

Reputation:

Can't get meta information with jQuery

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

Answers (2)

A.B
A.B

Reputation: 20445

find it in head tag

 $("head").find("meta[name='description']").attr("content");

Upvotes: 1

War10ck
War10ck

Reputation: 12508

Pass jQuery the selector directly and retrieve the value of the content attribute like so:

$('meta[name="description"]').attr("content");

Upvotes: 2

Related Questions