Im struggling to find any information on getting meta values.
I have a locale set in the meta on a few sites and would like to use a centralised js file so i need to grab the value from say for example
<meta name="locale" id开发者_Python百科="locale" content="en_ZA" />
hmmmm....
Many thanks
var m = $("meta[name=locale]");
alert(m.attr("content"));
Would that suffice?
Easy way with example code-
var content = $("meta[name=listing-page-url]").attr("content");
console.log(content);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<meta name="listing-page-url" content="demo-url" />
精彩评论