-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyscript.js
More file actions
49 lines (41 loc) · 1.3 KB
/
Copy pathmyscript.js
File metadata and controls
49 lines (41 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const modal = document.getElementById('mcontainer');
document.getElementById('hamenu').addEventListener('click', () => {
modal.style.display = 'flex';
});
const close = document.getElementById('times');
close.onclick = function () {
modal.style.display = 'none';
};
const portfoliopage = document.getElementById('portfoliopage');
portfoliopage.onclick = function () {
modal.style.display = 'none';
};
const about = document.getElementById('aboutpage');
about.onclick = function () {
modal.style.display = 'none ';
};
const contact = document.getElementById('contactpage');
contact.onclick = function () {
modal.style.display = 'none';
};
// validation
const forms = document.getElementById('getForm');
const msg = document.getElementById('small');
const success = document.getElementById('success');
const email = document.getElementById('email');
function checkEmail(email) {
return email === email.toLowerCase();
}
forms.addEventListener('submit', (e) => {
e.preventDefault();
if (checkEmail(email.value)) {
msg.classList.add('showMessage');
success.classList.remove('showSuccess');
forms.submit();
} else {
msg.textContent = 'Please remove any uppercase!';
msg.classList.remove('showMessage');
success.classList.add('showSuccess');
success.textContent = 'success';
}
});