JavaScript
Article

jQuery Scramble Web Page Email Addresses

By Sam Deering

Awesome jQuery script which scrambles/hides all email address on your webpages. It could be used to prevent spammers and bots getting your email address and using them to no good.

jQuery(document).ready(function($) {
	//email spam protection - Example Markup: 
	$('.email').each(function() {
		var $email = $(this);
		var address = $email.text()
		.replace(/s*[at]s*/, '@')
		.replace(/s*[dot]s*/g, '.');
		$email.html(''+ address +'');
	});
});
Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.