Search code examples
css

How to write css selector for to get description from meta tag


from meta tag i want to write css selector for to get content from here meta[name='description']|content.May i know how to get that that content , when ever the name="description" then only i need to get the content from meta tag by using css selector meta[name='description']&content i wnat to get from css selector

<meta name="description" content="efbfbfifckfuvhd">


Solution

  • It is not possible with CSS , Because CSS cannot return a content

    But you can try it with Javascript like this:

    document.querySelector("meta[name='description']").getAttribute("content");