20 lines
357 B
Markdown
20 lines
357 B
Markdown
importance: 5
|
|
|
|
---
|
|
|
|
# Add an option to select
|
|
|
|
There's a `<select>`:
|
|
|
|
```html
|
|
<select id="genres">
|
|
<option value="rock">Rock</option>
|
|
<option value="blues" selected>Blues</option>
|
|
</select>
|
|
```
|
|
|
|
Use JavaScript to:
|
|
|
|
1. Show the value and the text of the selected option.
|
|
2. Add an option: `<option value="classic">Classic</option>`.
|
|
3. Make it selected.
|