javascriptjquerymeta-tags

Get `Meta` attribute `content` by selecting `property` attribute


In jQuery you can do this:

$("meta[property='fb:app_id']").attr("content");

Which will give you the content attribute value from the meta-tag with property attribute "fb:app_id".

How can I do this in plain ol' Javascript?

Thank you in advance. :-)

Kenneth


Solution

  • document.querySelector('meta[property~="fb:app_id"][content]').content