Skip to content

Instantly share code, notes, and snippets.

@waako
Created August 18, 2011 06:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waako/1153408 to your computer and use it in GitHub Desktop.
Save waako/1153408 to your computer and use it in GitHub Desktop.
add break before @ symbol if email address is longer than n characters
/* Add a line break before the @ in email addresses if longer than n characters to help legibility and prevent widows */
jQuery('.contact-information-box a.email:contains("@")').each(function() {
var getContent=$(this).text();
if( $(this).text().length > 31) {
var newString=getContent.replace('@','<br />@');
}
jQuery(this).html(newString);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment