jQuery选择meta [property = og:image]? [英] Jquery Select meta[property=og:image]?

查看:389
本文介绍了jQuery选择meta [property = og:image]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Jquery中选择网页中的主要照片,我只有url页面. 所以我决定使用为Facebook共享而编写的元数据.

I want to select in Jquery the main photo in a web page, I just have the url page. so I decided to use the meta written for Facebook sharing.

我要选择的内容: meta property ="og:image" content ="http://blablabla.jpg"

I want to select the content of : meta property="og:image" content="http://blablabla.jpg"

我写了这个,但是不起作用: $("meta [property = og:image]").attr("content");

I wrote this, but it doesn't work: $("meta[property=og:image]").attr("content");

有什么想法吗? 谢谢

推荐答案

$('meta[property="og:image"]').attr('content')

http://jsfiddle.net/ZxmCw/

这篇关于jQuery选择meta [property = og:image]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆