-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #435 from nidhipai78/email
Message added on successful subscription #434
- Loading branch information
Showing
1 changed file
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,11 +159,35 @@ | |
</div> | ||
<div class="newsletter"> | ||
<div class="footer_titles">Subscribe to our newsletter</div> | ||
<form> | ||
<input type="text" id="emailId" name="email" placeholder="Your Email"> | ||
<button type="submit">Subscribe</button> | ||
<form id="subscriptionForm"> | ||
<input type="email" id="emailId" name="email" placeholder="Your Email" required> | ||
<button type="submit">Subscribe</button> | ||
</form> | ||
<div id="subscriptionMessage" style="display: none;">You have subscribed successfully!</div> | ||
</div> | ||
|
||
<script> | ||
document.getElementById("subscriptionForm").addEventListener("submit", function(event) { | ||
event.preventDefault(); // Prevent the form from submitting | ||
|
||
// Get the email input value | ||
var email = document.getElementById("emailId").value; | ||
|
||
// Email validation using regular expression | ||
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | ||
if (!emailRegex.test(email)) { | ||
alert("Please enter a valid email address."); | ||
return; | ||
} | ||
|
||
// Simulate subscription (you may replace this with actual subscription code) | ||
// For now, just displaying the success message | ||
document.getElementById("subscriptionMessage").style.display = "block"; | ||
}); | ||
</script> | ||
|
||
|
||
|
||
<div class="contact"> | ||
<div class="footer_titles">Contact Us</div> | ||
<a href="mailto:[email protected]"><div class="mail">[email protected]</div></a> | ||
|