Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message added on successful subscription #434 #435

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading