jQuery Tutorials – Hide/protect mailto: links from spam bots and email harvesters #3

Sharing is caring!

Here is a jQuery snippet that can protect email addresses from email harvesters.

All you need to do is to inlcude .mail class to your “mailto:” html links like the example below.

 

line 2: Gather all the elements with the matched criteria

line 3: Iterate on these elements

line 4: on each loop get the href attribute value of the current element (which is “peter_[at]_example.com”)

line 5: rewrite the href attribute value to “[email protected]” from  “whatever_[at]_whatever”

line 6: get the html content of the current element

line 7: rewrite the html content of the current element

 

Geeks are sexy… :D

Download Example : JQueryEmailProtectSnippet

@specktator

Series Navigation<< jQuery Tutorials – Hide/protect mailto: links from spam bots and email harvesters #2

Comment:

This site uses Akismet to reduce spam. Learn how your comment data is processed.