How to find and read metadata using jQuery (schema.org microformat)?

后端 未结 2 1316
死守一世寂寞
死守一世寂寞 2021-02-14 09:27

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:

<         


        
相关标签:
2条回答
  • 2021-02-14 09:47

    Have you tried this?

    jQuery(function($){
      var latitude = $('.geo meta[itemprop="latitude"]').attr("content");
      var longitude = $('.geo meta[itemprop="longitude"]').attr("content");
    });
    
    0 讨论(0)
  • 2021-02-14 09:55

    You can get at the data like so:

    $('meta[itemprop="latitude"]').attr('content')

    0 讨论(0)
提交回复
热议问题