-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontactform.js
30 lines (25 loc) · 866 Bytes
/
contactform.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function contactInfo() {
var nameVar = document.getElementById('name').value;
var emailVar = document.getElementById('email').value;
var subjectVar = document.getElementById('subject').value;
var messageVar = document.getElementById('message').value;
if (emailVar.includes('@' && '.com') && messageVar.includes(' ')) {
swal({
title: "Thanks for the feedback!",
text: "We will get back to you ASAP",
icon: "success",
button: "Continue",
});
} else {
swal({
title: "Ooooops...",
text: "Please fill in all the fields correctly",
icon: "error",
button: "try again",
});
}
}
const contactForm = document.getElementById("contactForm");
contactForm.addEventListener("submit", (e) => {
e.preventDefault();
});