New Text Document
New Text Document
// while(true){
// const username = prompt(`what is your name`)
// let usercheck = usernameValidate(username)
// while(true){
// const Firstname = alert(`what your name`)
// let usercheck = usernameValidate(Firstname)
document.addEventListener("DOMContentLoaded", ()=> {
//get refrence o the existing boxes by their IDs
const firstname = document.getElementById("firstname");
const lastname = document.getElementById("lastname");
const email = document.getElementById("email");
const password = document.getElementById("password");
const telephone = document.getElementById("telephone")
//sequentialValidation
if (!firstNamePattern.test(firstName.value)) {
alert("First Name must be 5 alphabet");
firstName.focus();
return;
}
if (!lastNamePattern.test(lastname.value)) {
alert("Last Name must be 6 alpahbet");
lastName.focus();
return;
}
if (!emailPatten.test(email.value)) {
alert("please enter a valid email address\nthe email shoulb be 5 alphabets
folowed by @ and whatever mail you use");
email.focus();
return;
}
if (!passwordPattern.test(password.value)) {
alert("passwprd should contain only 4 alphabet");
password.focus();
return;
}
if (!telephonePattern.test(telephone.value)) {
alert("phine number must be exactly 11 digits.");
telephone.focus();
return;
}