Posted By

BebenKoben on 01/18/11


Tagged

jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

virendrakryadav


Email link with jQuery Plugin


 / Published in: jQuery
 

  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  

You need to login to post a comment.