We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 717490e commit ad555abCopy full SHA for ad555ab
1 file changed
dom/onChange.html
@@ -0,0 +1,26 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>onChange with Select</title>
7
+ <script>
8
+ function handleSelectionChange(event) {
9
+ const selectedOption = event.target.value;
10
+ document.getElementById("selectedOption").innerText = `You selected: ${selectedOption}`;
11
+ }
12
+ </script>
13
+</head>
14
+<body>
15
+
16
+ <label for="colors">Choose a color: </label>
17
+ <select id="colors" onChange="handleSelectionChange(event)">
18
+ <option value="Red">Red</option>
19
+ <option value="Green">Green</option>
20
+ <option value="Blue">Blue</option>
21
+ </select>
22
+ <p id="selectedOption">You selected: </p>
23
24
+</body>
25
+</html>
26
0 commit comments