Skip to content

Instantly share code, notes, and snippets.

@dissolvdgrl
Last active December 16, 2019 07:28
Show Gist options
  • Save dissolvdgrl/2eebb89c07cfd0076a4aa93b3e89cd89 to your computer and use it in GitHub Desktop.
Save dissolvdgrl/2eebb89c07cfd0076a4aa93b3e89cd89 to your computer and use it in GitHub Desktop.
function printEmail(className, first, last) {
let emailAddress = `<a href="mailto:${first}@${last}" class="link">${first}@${last}</a>`;
let span = document.querySelectorAll('.' + className), i;
for (i = 0; i < span.length; ++i) {
span[i].innerHTML = emailAddress;
}
}
printEmail('container', 'john', 'example.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment