Skip to content

Instantly share code, notes, and snippets.

@dev1ne
Created August 2, 2013 19:39
Show Gist options
  • Select an option

  • Save dev1ne/6142800 to your computer and use it in GitHub Desktop.

Select an option

Save dev1ne/6142800 to your computer and use it in GitHub Desktop.
Replace [AT] and [DOT] in mailto links in jQuery
/*********************************
MAIL LINKS
*********************************/
$('a[href^="mailto"]').each(function(){
var $link = $(this);
var href = $link.attr('href');
var text = $link.text();
href=href.replace('[AT]','@');
href=href.replace('[DOT]','.');
text=text.replace('[AT]','@');
text=text.replace('[DOT]','.');
$link.attr('href',href);
$link.text(text);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment