-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolors3.html
More file actions
25 lines (23 loc) · 759 Bytes
/
colors3.html
File metadata and controls
25 lines (23 loc) · 759 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
<!DOCTYPE html>
<html>
<head>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Change the color of the heading when dropdown changes
document.querySelector('#color-change').onchange = function() {
document.querySelector('#hello').style.color = this.value;
};
});
</script>
<title>My Website</title>
</head>
<body>
<h1 id="hello">Hello!</h1>
<select id="color-change">
<option value="black">Black</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
</body>
</html>