您好我想知道如何将DOM中的所有RSS提要匹配到数组中?
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.reddit.com/r/gaming/comments/qzoim/giving_away_500_copies_of_our_game_dungeon/.rss" />
任何想法?
答案 0 :(得分:1)
var myArray = [];
$("link").each(function(){
myArray.push(this.href);
});
答案 1 :(得分:1)
var links = [];
$('link[type="application/rss+xml"]').each(function() {
links.push($(this).attr('href'));
});
答案 2 :(得分:0)
var arr = [];
arr.forEach.call(
document.querySelectorAll('link[href*=".rss"]'),
function(el){
arr.push(el.href);
}
);
<强> Live Demo 强>
答案 3 :(得分:0)
var rssLinks = $('link[type="application/rss+xml"]').map(function(i,val) {
return val.href;
}).get();