I have the following code:
HTML
<head>
<meta property="article:section" content="Pop or Not" />
</head>
JS
<script>
jQuery(document).ready( function($) {
var metaSection $("meta[property='article:section']").attr("content");
if (metaSection.indexOf('Pop or Not') >= 0){
alert ('The is Pop Page!');
}
});
</script>
The problem is that I think I need to that in order to use the variable I've defined I need to convert it into a string. Would definitely like some input.
This should work if HTML is ok
var metaSection = $("meta[property='article:section']").attr("content"); if (metaSection.indexOf('Pop') >= 0) { alert('The is Pop Page!'); }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <head> <meta property="article:section" content="Pop" /> </head>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.