Advertisement
Kamend1

6.Validate - Lab

Mar 27th, 2025
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function validateEmail() {
  2.         let emailField = document.getElementById('email');
  3.         let emailValue = document.getElementById('email').value;
  4.         const pattern = /^[a-z]+@[a-z]+\.[a-z]+$/;
  5.        
  6.         if (!pattern.test(emailValue)) {
  7.             emailField.classList.add('error');
  8.         }
  9.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement