JAYASWAROOP commited on
Commit
96656a7
·
verified ·
1 Parent(s): e18dc80

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -5
index.html CHANGED
@@ -378,9 +378,9 @@
378
  once: true // Only animate elements once
379
  });
380
  document.addEventListener("DOMContentLoaded", function() {
381
- const submitButton = document.getElementById("submitBtn");
382
 
383
- submitButton.addEventListener("click", function(event) {
384
  event.preventDefault(); // Prevent the default form submission
385
 
386
  // Retrieve form data
@@ -388,14 +388,19 @@ document.addEventListener("DOMContentLoaded", function() {
388
  const email = document.getElementById("email").value;
389
  const message = document.getElementById("message").value;
390
 
391
- // Use Gmail API (configure your credentials)
392
- // Compose the email with form data
393
- // Send the email to your Gmail account
 
 
394
 
395
  // Example: Log the form data (replace with Gmail API code)
396
  console.log("Name:", name);
397
  console.log("Email:", email);
398
  console.log("Message:", message);
 
 
 
399
  });
400
  });
401
  </script>
 
378
  once: true // Only animate elements once
379
  });
380
  document.addEventListener("DOMContentLoaded", function() {
381
+ const contactForm = document.getElementById("contactForm");
382
 
383
+ contactForm.addEventListener("submit", function(event) {
384
  event.preventDefault(); // Prevent the default form submission
385
 
386
  // Retrieve form data
 
388
  const email = document.getElementById("email").value;
389
  const message = document.getElementById("message").value;
390
 
391
+ // Construct the email body
392
+ const emailBody = `Name: ${name}\nEmail: ${email}\nMessage:\n${message}`;
393
+
394
+ // Send the email using Gmail API (configure your credentials)
395
+ // Replace with your actual Gmail API code
396
 
397
  // Example: Log the form data (replace with Gmail API code)
398
  console.log("Name:", name);
399
  console.log("Email:", email);
400
  console.log("Message:", message);
401
+
402
+ // Optionally, display a success message to the user
403
+ alert("Thank you! Your message has been sent.");
404
  });
405
  });
406
  </script>