0
我想获得基于属性值的属性值attr值。我如何在JavaScript中做到这一点?JQuery获取具有相同名称的属性值
<links>
<link href="https://someurl/index/16380" rel="self"/>
<link href="https://someurl/index/16380/streams?lang=en" rel="streams"/>
<link href="https://someurl/index/16380/bif" rel="bif" />
</links>
沿线的东西....
$(xml).find('link').each(function(){
if(rel == 'streams'){
this.streamurl = $(this).attr('href');
}
});
'$ (this).attr('rel');',除非我在这里丢失东西? –
所以你想知道如何读取rel属性?如果是这样@ShadowWizard有你的答案 – Liam
@ShadowWizard,我想获得href的值,其中rel =“streams”。 $(本).attr( '相对');只会给我rel的价值。 – Fabii