Skip to content

Commit

Permalink
Implement length constraint for message in Contact Us form (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarzookhunger authored May 27, 2024
1 parent 369ed14 commit beabfdf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion assets/contact/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ ham.addEventListener("click", mobileMenu);
function mobileMenu() {
ham.classList.toggle("active");
navMe.classList.toggle("active");
}
}

// text message length not less than 50 chars
document.addEventListener('DOMContentLoaded', function() {
const contactForm = document.getElementById('contact-form');
const messageInput = document.getElementById('message');

contactForm.addEventListener('submit', function(event) {
if (messageInput.value.length < 50) {
event.preventDefault();
alert('Your message must be at least 50 characters long.');
}
});
});

0 comments on commit beabfdf

Please sign in to comment.