/ Published in: JavaScript
Use a regex to check the email address input
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function checkEmail(email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if (!reg.test(email)) return false; return true; }