From bb835c5a7ac3ae17714cd5f82c1e76afee5b400f Mon Sep 17 00:00:00 2001 From: akash70629 Date: Thu, 31 Oct 2024 13:21:53 +0530 Subject: [PATCH 1/2] validation added --- index.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 71a1524..bbd3c00 100644 --- a/index.html +++ b/index.html @@ -573,15 +573,18 @@

Contact Our Customer Support Team

- +
- +
- +
From d9ba4374e35e62e13147b0ebcd4b46c18338dd8a Mon Sep 17 00:00:00 2001 From: akash70629 Date: Sat, 2 Nov 2024 00:18:49 +0530 Subject: [PATCH 2/2] validation added to the script.js file --- index.html | 5 +---- script.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index bbd3c00..e5d7941 100644 --- a/index.html +++ b/index.html @@ -573,10 +573,7 @@

Contact Our Customer Support Team

- +
diff --git a/script.js b/script.js index 1875905..93ee39d 100644 --- a/script.js +++ b/script.js @@ -520,3 +520,15 @@ function displayVisitorCount() { // Call the display function when the page loads document.addEventListener('DOMContentLoaded', displayVisitorCount); +//Name validation function on index page , Contact us section + +const nameInput = document.getElementById('name'); + +nameInput.addEventListener('input', () => { + const name = nameInput.value.trim(); + if (!/^[a-zA-Z ]+$/.test(name)) { + nameInput.setCustomValidity('Numbers and symbols are not allowed'); + } else { + nameInput.setCustomValidity(''); + } +}); \ No newline at end of file