diff --git a/assets/js/script.js b/assets/js/script.js index 96c9572..dfe4c09 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -38,4 +38,15 @@ for (let i = 0; i < themeBtn.length; i++) { }) -} \ No newline at end of file +} + +// contribute code + +const form = document.querySelector('.newsletter form'); +form.addEventListener('submit', (e) => { + const email = form.querySelector('input[name="email"]').value; + if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { + e.preventDefault(); + alert('Please enter a valid email address.'); + } +}); \ No newline at end of file diff --git a/index.html b/index.html index cda1e66..5876400 100644 --- a/index.html +++ b/index.html @@ -137,8 +137,6 @@ - -
@@ -865,10 +859,6 @@

Newsletter

- - - -