Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jquery wrap a e-mail address
  2. str = str.replace(/([a-z]+[-@-][a-z]+.[a-z]+)/g,'<span>$1</span>');
  3.        
  4. var emailArray = ["test1[-@-]test.com", "test2[-@-]test.com", "test3[-@-]test.com"];
  5. $.each(emailArray, function (index) {
  6.     emailArray[index] = $('<span>' + emailArray[index] + '</span>');
  7. });
  8.        
  9. function wrap(text, element) {
  10.     return document.createElement(element).innerText(text);
  11. }