سؤال

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

هل كانت مفيدة؟

المحلول

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

http://jsfiddle.net/ZxmCw/

نصائح أخرى

:image is parsed as a pseudo-selector. I think you need quotes around "og:image"

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top