Created
February 13, 2015 14:57
-
-
Save tvaliasek/423385165ae298b9d950 to your computer and use it in GitHub Desktop.
Simple jQuery email obfuscation function
This file contains 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
/* | |
* Simple jQuery function for email obfuscation | |
* | |
*<a href="mailto:some#zavinac#email.cz" target="_blank" title="Email link">some#zavinac#email.cz</a> | |
* | |
*/ | |
jQuery(function(){ | |
$("a[href^='mailto:']").each(function(){ | |
var $repl = $(this).attr('href'); | |
$(this).attr('href', $repl.replace(/(\#zavinac\#)/ig, '@')); | |
$repl = $(this).text(); | |
$(this).text($repl.replace(/(\#zavinac\#)/ig, '@')); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment