-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
19 lines (19 loc) · 721 Bytes
/
script.js
File metadata and controls
19 lines (19 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const buts = document.querySelectorAll('.button');
const body = document.querySelector("body");
buts.forEach(function(button){
button.addEventListener('click' ,function(e){
//e.taget. kuch bhi likho jo bhi information chahiya or jo tumhre e varible mae event perform hone kai baad hue hogi.
if(e.target.id=== 'yellow'){
body.style.backgroundColor = "yellow";
}
if(e.target.id=== 'grey'){
body.style.backgroundColor = "grey";
}
if(e.target.id=== 'black'){
body.style.backgroundColor = "black";
}
if(e.target.id=== 'red'){
body.style.backgroundColor = "red";
}
});
});