/* JS Extract a value an then change it */
// -------- anti spam script
$(function(){
var emailLink = $(".obfuscate"); //span
var atsign = "@";
if (emailLink.length > 0){
for (var i = 0; i < emailLink.length; i++) {
var user = $(emailLink[i]).attr("data-mail-user");
var domain = $(emailLink[i]).attr("data-mail-domain");
var addr = user + atsign + domain;
var emailTxtValue = $(emailLink[i]).find(".value"); // find and store email value if used
if (emailTxtValue) {
$(emailLink[i]).find(".value").text(addr);
}
if (user.length > 0){ // optional alternative source for link text. Defaults to email address if no title is defined
var linkTitle = $(emailLink[i]).attr("data-mail-linktext");
if (linkTitle){
var emailTxtValue = $(emailLink[i]).find(".value").text(linkTitle);
}
var newContent = $(emailLink[i]).html().trim();
$(emailLink[i]).replaceWith("<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" + newContent + "<\/a>");//contacttxt
}
}
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.