Created
October 6, 2023 06:46
-
-
Save annuman97/b92f2a035a174de2c4c651da1cda876a to your computer and use it in GitHub Desktop.
MakeAllLinksandMailAddressClickable
This file contains hidden or 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 desc = Array.from(document.querySelectorAll('td.link')); | |
desc.forEach((cell) => { | |
let cellVal = cell.innerText.split(' '); | |
cellVal.find((val)=>{ | |
if(val.includes('@')){ | |
let replaceText = cell.innerHTML.replace(val, `<a href="mailto:${val}">${val}</a>`); | |
cell.innerHTML = replaceText; | |
}else if(val.includes('http')){ | |
let replaceText = cell.innerHTML.replace(val, `<a href="${val}">${val}</a>`); | |
cell.innerHTML = replaceText; | |
} | |
}) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment