diff --git a/assets/js/script.js b/assets/js/script.js index da49fef..5f736b8 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -39,4 +39,28 @@ window.addEventListener("scroll", function () { header.classList.remove("active"); backTopBtn.classList.remove("active"); } -}); \ No newline at end of file +}); + +// Hero form variables +const heroForm = document.querySelector("[data-hero-form]"); +const heroFormInput = document.querySelector("[data-hero-form-input]"); +const successMessage = document.getElementById("hero-success-message"); + +// Listen for form submit +heroForm.addEventListener("submit", function (e) { + e.preventDefault(); // Prevent the default form submission + + // Check if the form is valid + if (heroForm.checkValidity()) { + // Show success message + successMessage.style.display = "block"; + + // Clear the form input field + heroFormInput.value = ""; + + // Hide the success message after 3 seconds + setTimeout(() => { + successMessage.style.display = "none"; + }, 3000); + } +}); diff --git a/index.html b/index.html index 25e2fee..54917b1 100644 --- a/index.html +++ b/index.html @@ -113,13 +113,11 @@