I am trying to prevent as much spam form submissions on a lead generation form from happening. The idea is to ensure the email field must include an @ symbol and the website field must include a '.'. How would I go about achieving this with JS.
Just a heads up, I am using contact form 7 on Wordpress so any solutions for that would be amazing.
If you have any questions please ask :)
you can use regex to evaluate your email
function validateEmail(email) {
const reg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return reg.test(String(email).toLowerCase());
}
All you need to do is just pass the entered email to this function and it will help you determine whether its a valid or invalid one