Email link with jQuery Plugin


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'/></script>
  2.  
  3. <script type='text/javascript'>
  4. $(function() {
  5. $('.email').each(function(i) {
  6. var spamisTrash = $(this).html();
  7. spamisTrash = spamisTrash.replace("[at]", "@");
  8. spamisTrash = spamisTrash.replace("[dot]", ".");
  9. $(this).html(spamisTrash).replaceWith("<a href=\"mailto:" + $(this).text() + "\">" + $(this).text() + "</a>");
  10. });
  11. });
  12. </script>
  13.  
  14. <div class="email">YourEmailID[at]gmail[dot]com</div>
  15.  
  16. <p class="email">YourEmailID[at]yahoo[dot]com</p>
  17.  
  18. <span class="email">YourEmailID[at]blahblehbloh[dot]com</span>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.