i saw code time ago, , planning list hrefs of website, want filter it
var arr = [], l = document.links; for(var i=0; i<l.length; i++) { arr.push(l[i].href); } alert(arr);
i need code display links contains text in it
for example show in alert links contains in href
....?day=20, ?day=22, , ?day=25
i tried add 1 if before .push, nothing worked, showed blank alert :(
last thing, if in place of alert want open in new tab each link, can give me direction or simplest way ;)
in modern browsers can this:
var links = document.queryselectorall('a[href*="day"]');
that give nodelist of link elements contain day
in href
. can filter hrefs
in array:
var hrefs = array.prototype.map.call(links, function(link){ return link.href; });
Comments
Post a Comment