-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (23 loc) · 849 Bytes
/
Copy pathscript.js
File metadata and controls
23 lines (23 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const span=document.querySelectorAll('.button');
const body=document.querySelector("body");
span.forEach((button)=>{
button.addEventListener('click',function(e){
console.log(e);
console.log(e.target);
switch(e.target.id){
case 'pink':body.style.backgroundColor='#D81B60';
break;
case 'white':body.style.backgroundColor='#FAFAFA';
break;
case 'purple':body.style.backgroundColor='#BA68C8';
break;
case 'orange':body.style.backgroundColor='#FF9100';
break;
case 'brown':body.style.backgroundColor='#6D4C41';
break;
case 'blue':body.style.backgroundColor='#4DD0E1';
break;
default:break;
}
});
});