-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (21 loc) · 948 Bytes
/
Copy pathscript.js
File metadata and controls
29 lines (21 loc) · 948 Bytes
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
document.getElementById("box-1").addEventListener("click", function(){
this.style.backgroundColor = "red";
this.style.color = "white";
});
document.getElementById("box-2").addEventListener("click", function(){
this.style.backgroundColor = "blue";
this.style.color = "white";
});
document.getElementById("box-3").addEventListener("click", function(){
this.style.backgroundColor = "green";
this.style.color = "white";
});
document.getElementById("box-4").addEventListener("click", function(){
this.style.backgroundColor = "yellow";
});
const input = document.getElementById("name");
const greeting = document.getElementById("greeting");
const button = document.getElementById("btn-button");
button.addEventListener("click", function () {
greeting.textContent = "Hello, " + input.value;
});