Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图在“html > head > link”下获取 rel 的值。(链接 rel='shortlink')。
我试过这段代码(和其他一些)没有运气,它只是说“未定义”。
var shrt = jQuery("html > head > link").find('shortlink').attr('rel'); alert("short: " + shrt);
任何人?
尝试使用如下属性选择器,
$('link[rel=shortlink]')
var findit = $('head').find('link[rel="shortlink"]');