如何使用jQuery(schema.org微格式)查找和读取元数据? [英] How to find and read metadata using jQuery (schema.org microformat)?
本文介绍了如何使用jQuery(schema.org微格式)查找和读取元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在构建一个Google地图应用程序,并且想要读出元数据,如 schema.org 从我的HTML中绘制我的地图标记。
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");
});
这篇关于如何使用jQuery(schema.org微格式)查找和读取元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文