Skip to content

Instantly share code, notes, and snippets.

@Tom-Millard
Last active August 29, 2015 14:23
Show Gist options
  • Save Tom-Millard/0a8765daeed900207823 to your computer and use it in GitHub Desktop.
Save Tom-Millard/0a8765daeed900207823 to your computer and use it in GitHub Desktop.
Email Injection Script JS
function EmailInjection(){
var t = this;
t.inject = function(className, href){
var h = href.join("")
, e = document.getElementsByClassName(className)
;
for(var x = 0, xl = e.length; x<xl; ++x){
e[x].href = "mailTo:" + h;
e[x].innerHTML = e[x].innerHTML.replace('[e]', h);
console.log(e);
}
return;
}
}
e=new EmailInjection();
e.inject("js-email-address",["section1","@","section2",".","com"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment