Form mail spam blocker

,

Form mail spam blocker

Posted on: December 17, 2014 Category: Freebies, Website Tips Comments: 0

We found this great trick to block most spam for any form mail type form.

Just paste this right above the submit button in the code:

 

<div id=”fooDiv”>
<label for=”foo”>Leave this field blank</label>
<input type=”text” name=”foo” id=”foo”>
</div>
<script>
(function () {
var e = document.getElementById(“fooDiv”);
e.parentNode.removeChild(e);
})();
</script>

 

 

The will eliminate almost all spam and the form will still work as normal. You can add a Captcha for the best possible protection but this is much easier and works very well.