Skip to content

Commit e9a6da2

Browse files
committedApr 13, 2023
modified: index.html
modified: script.js
1 parent fcddc93 commit e9a6da2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
 

‎index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ <h5 class="" style="font-weight: 500">
718718
<input
719719
class="form-control"
720720
type="email"
721-
placeholder="Your Email Here"
721+
placeholder="Your Email Here" required
722722
/>
723723
<button class="btn">Subscribe</button>
724724
</form>

‎script.js

+10
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,13 @@ function goToPage(url) {
5454
window.location.href = url;
5555
}
5656

57+
const form = document.querySelector('.newsLetterForm');
58+
const emailInput = form.querySelector('input[type="email"]');
59+
60+
form.addEventListener('submit', (event) => {
61+
event.preventDefault();
62+
const email = emailInput.value;
63+
localStorage.setItem('newsletterEmail', email);
64+
emailInput.value = '';
65+
alert('You are now subscribed to our newsletter!');
66+
});

0 commit comments

Comments
 (0)
Please sign in to comment.