└── Validation ├── 3d-casual-life-young-people-discussing-team-project-at-a-laptop (1).png ├── SignUp.js ├── SignUp.html └── SignUp.css /Validation/3d-casual-life-young-people-discussing-team-project-at-a-laptop (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kavinkumar1510/User-Validation/HEAD/Validation/3d-casual-life-young-people-discussing-team-project-at-a-laptop (1).png -------------------------------------------------------------------------------- /Validation/SignUp.js: -------------------------------------------------------------------------------- 1 | function valid() { 2 | let name = document.getElementById("name").value.trim(); 3 | let email = document.getElementById("email").value; 4 | let pass1 = document.getElementById("pass1").value; 5 | let pass2 = document.getElementById("pass2").value; 6 | let num = document.getElementById("num").value; 7 | 8 | const phn = /^\d{10}$/; 9 | const em = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; 10 | 11 | if (name === "" || name<=65 || name>=122 || name.length<5) { 12 | alert("Invalid Username"); 13 | return false; 14 | } 15 | 16 | if (num === "" || !phn.test(num)) { 17 | alert("Enter a valid PhoneNumber"); 18 | return false; 19 | } 20 | 21 | if (email === "" || !em.test(email)) { 22 | alert("Enter a valid email"); 23 | return false; 24 | } 25 | 26 | if (pass1.length < 8) { 27 | alert("The password length should be 8 or more than 8"); 28 | return false; 29 | } 30 | 31 | if (pass1 !== pass2) { 32 | alert("The password doesn't match"); 33 | return false; 34 | } 35 | 36 | alert("SignedUp Successfully"); 37 | return true; 38 | } 39 | -------------------------------------------------------------------------------- /Validation/SignUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 |