forked from Ravishashi07/anything-new
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (20 loc) · 801 Bytes
/
Copy pathscript.js
File metadata and controls
26 lines (20 loc) · 801 Bytes
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
// script.js
document.addEventListener("DOMContentLoaded", () => {
const form = document.getElementById("contact-form");
form.addEventListener("submit", (e) => {
e.preventDefault(); // Prevent form submission
const name = document.getElementById("name").value;
const email = document.getElementById("email").value;
const message = document.getElementById("message").value;
// Basic validation
if (!name || !email || !message) {
alert("Please fill out all fields.");
return;
}
// Simulate sending data
console.log("Form submitted:", { name, email, message });
alert("Thank you for reaching out! We will get back to you soon.");
// Clear form
form.reset();
});
});