Skip to main content

jQuery Scramble Web Page Email Addresses

By Sam Deering



😳 Ever felt a little embarassed sharing your JavaScript? Let's fix it.

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 +'');

Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

New books out now!

💁‍♀️ Fun Fact: Python was ranked #2 on a recent highest paid coders list. *

🤓 Ok. When did a code editor from Microsoft become kinda cool!?