JavaScript
Article
By Sam Deering

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.

--ADVERTISEMENT--

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
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account