generated from microverseinc/readme-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspa.js
30 lines (27 loc) · 1.14 KB
/
spa.js
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
const list = document.querySelector('.list');
const addNew = document.querySelector('.addNew');
const contact = document.querySelector('.contact');
addNew.addEventListener('click', () => {
const form = document.getElementById('form');
const contactSection = document.getElementById('contactSection');
const listSection = document.getElementById('listSection');
listSection.classList.add('hidden');
contactSection.classList.add('hidden');
form.classList.remove('hidden');
});
contact.addEventListener('click', () => {
const form = document.getElementById('form');
const contactSection = document.getElementById('contactSection');
const listSection = document.getElementById('listSection');
listSection.classList.add('hidden');
form.classList.add('hidden');
contactSection.classList.remove('hidden');
});
list.addEventListener('click', () => {
const form = document.getElementById('form');
const contactSection = document.getElementById('contactSection');
const listSection = document.getElementById('listSection');
form.classList.add('hidden');
contactSection.classList.add('hidden');
listSection.classList.remove('hidden');
});