Search code examples
javascriptarraystooltiphref

Alert show some hrefs and others not, i want all hrefs that contain the word


This js searches for hrefs that contain page=fleet in them:

var links = document.querySelectorAll('a[href*="page=fleet"]');

var hrefs = Array.prototype.map.call(links, function(link){
  return link.href;
});

alert(hrefs.join('\n'));

but only some hrefs it show, look this image and you will understand:

enter image description here

the <a href="...."> is the same, but why don't the three inside the a with class tooltip show up?


Solution

  • As the syntax highlighting is trying to tell you, those aren't tags.

    Instead, that's a giant name attribute that happens to contain text that looks like HTML tags.

    Your HTML is messed up and should be fixed.