From 95ba266a4e20a89faca4c42047ddb60f555df0c3 Mon Sep 17 00:00:00 2001 From: Adithya S Nair Date: Fri, 18 Oct 2024 20:03:56 +0530 Subject: [PATCH] Solved name validation --- newLogin.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/newLogin.html b/newLogin.html index eb6e528a..a868a02c 100644 --- a/newLogin.html +++ b/newLogin.html @@ -139,6 +139,15 @@

Start your
journey now

validateForm("register"); }); + //Form validation for registration name + document.getElementById("registerName").addEventListener("keypress", function (event) { + var char = String.fromCharCode(event.which); + if (!(/[a-zA-Z]/.test(char))) { + event.preventDefault(); + } + }); + + document.getElementById("loginForm").addEventListener("submit", function (event) { event.preventDefault(); validateForm("login");