Created
September 18, 2020 18:14
-
-
Save theoomoregbee/883f2707abcd65ccb1a2f00b7736b008 to your computer and use it in GitHub Desktop.
Get all the links within a HTML page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const links = []; | |
var links = document.getElementsByTagName("a"); | |
for (var i = 0, max = links.length; i < max; i++) { | |
const href = links[i].href; | |
links.push(href) | |
} | |
console.log("Links", links); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment