Skip to content

Instantly share code, notes, and snippets.

@aryankarim
Created February 6, 2024 00:03
Show Gist options
  • Save aryankarim/93d3bb20f8c6da39554e4bdaa27e8f81 to your computer and use it in GitHub Desktop.
Save aryankarim/93d3bb20f8c6da39554e4bdaa27e8f81 to your computer and use it in GitHub Desktop.
Open Multiple Tabs/Anchors with JavaScript
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