I'm building a Google Maps application and I'd like to read out the metadata, as specified by schema.org , from my HTML to plot my map markers.
For example:
<li itemscope="itemscope" itemtype="http://schema.org/LocalBusiness">
...some html...
<div class="geo" itemprop="geo" itemscope="itemscope" itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="43.681505" />
<meta itemprop="longitude" content="-79.294455" />
</div>
</li>
Is there an easy way to query out the latitude and longitude values without having loop through everything?
Have you tried this?
jQuery(function($){
var latitude = $('.geo meta[itemprop="latitude"]').attr("content");
var longitude = $('.geo meta[itemprop="longitude"]').attr("content");
});
您可以像这样获取数据:
$('meta[itemprop="latitude"]').attr('content')
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.