문제

I'm trying to get the value of a rel under "html > head > link". (link rel='shortlink').

I've tried this code (and some others) with no luck, it just says "undefined".

var shrt = jQuery("html > head > link").find('shortlink').attr('rel');

alert("short: " + shrt);

Anyone?

도움이 되었습니까?

해결책

Try using attribute selector like below,

$('link[rel=shortlink]')

다른 팁

var findit = $('head').find('link[rel="shortlink"]');

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top