Вопрос

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