Jquery 选择元[property=og:image]?
我想在 Jquery 中选择网页中的主照片,我只有 url 页面。 所以我决定使用为 Facebook 共享编写的元。
我想选择的内容: meta property="og:image" content="http://blablabla.jpg"
我写了这个,但它不起作用: $("meta[property=og:image]").attr("内容");
有什么想法吗? 谢谢
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.
I want to select the content of :
meta property="og:image" content="http://blablabla.jpg"
I wrote this, but it doesn't work:
$("meta[property=og:image]").attr("content");
Any ideas ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
$('meta[property="og:image"]').attr('content')
http:// jsfiddle.net/ZxmCw/
$('meta[property="og:image"]').attr('content')
http://jsfiddle.net/ZxmCw/
:image
被解析为伪选择器。我认为你需要围绕“og:image”引用:image
is parsed as a pseudo-selector. I think you need quotes around "og:image"