File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments