Created
February 6, 2024 00:03
-
-
Save aryankarim/93d3bb20f8c6da39554e4bdaa27e8f81 to your computer and use it in GitHub Desktop.
Open Multiple Tabs/Anchors with JavaScript
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
let anchorTags = document.getElementsByTagName('a') | |
let urls = [] | |
for (let index = 0; index < anchorTags.length; index++) { | |
const regExp = new RegExp(/^\s*\n*folder-name/g) // use RegExp or water to get the currect anchors | |
if(regExp.test(anchorTags[index].innerHTML)){ | |
urls.push(anchorTags[index].href) | |
} | |
} | |
for(let i = 0 ; i < urls.length ; i++){ | |
let newWindow = window.open(urls[i]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment