Add form submit script

This commit is contained in:
Maria Rushkova 2021-08-04 12:26:31 +02:00
parent 9778ff4ed3
commit d5ba3b108a
2 changed files with 15 additions and 2 deletions

View File

@ -87,17 +87,17 @@
<div class="flex flex-col w-52">
<h3 class="text-base text-white mb-5">Signup for updates</h3>
<form action="">
<form action="" class="footer__form">
<div class="flex items-center w-full">
<input
class="
text-xs text-white
opacity-50
w-full
bg-black
border-b border-white
mr-2
focus:outline-none
placeholder-white placeholder-opacity-50
"
type="email"
placeholder="your email"
@ -113,6 +113,11 @@
></button>
</div>
</form>
<p
class="footer__confirm text-base italic text-white opacity-75 hidden"
>
You signed up! Check your e-mail
</p>
</div>
</div>
</div>

View File

@ -6,6 +6,8 @@ const burgerClose = document.querySelector(".burger__button--close");
const menuMobile = document.querySelector(".nav-mobile");
const menuLinks = document.querySelectorAll(".nav__link");
const overlay = document.querySelector(".overlay");
const form = document.querySelector(".footer__form");
const confirmation = document.querySelector(".footer__confirm");
const closeMobileMenu = () => {
burgerOpen.classList.toggle("hidden");
@ -29,3 +31,9 @@ menuLinks.forEach(function (link) {
});
});
});
form.addEventListener("submit", function (e) {
e.preventDefault();
form.classList.toggle("hidden");
confirmation.classList.toggle("hidden");
});