-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
20 lines (16 loc) · 761 Bytes
/
index.js
File metadata and controls
20 lines (16 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const firstBtn = document.getElementById('btnOne');
const secondBtn = document.getElementById('btnTwo');
const thirdBtn = document.getElementById('btnThree');
const viewContainer = document.getElementById('viewContainer');
firstBtn.addEventListener('click', () => {
const firstBtnBgColor = getComputedStyle(firstBtn);
viewContainer.style.backgroundColor = firstBtnBgColor['background-color'];
})
secondBtn.addEventListener('click', () => {
const secondBtnBgColor = getComputedStyle(secondBtn);
viewContainer.style.backgroundColor = secondBtnBgColor['background-color'];
})
thirdBtn.addEventListener('click', () => {
const thirdBtnBgColor = getComputedStyle(thirdBtn);
viewContainer.style.backgroundColor = thirdBtnBgColor['background-color'];
})