Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validate() {
- const emailInput = document.getElementById('email');
- emailInput.addEventListener('change', function (e) {
- emailInput.classList.remove('error');
- const value = emailInput.value;
- if (value.match(/^[a-z-\.]+@[a-z-\.]+\.[a-z]{2,4}/)) {
- return;
- }
- emailInput.classList.add('error');
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement