en.javascript.info/2-ui/4-forms-controls/1-form-elements/1-add-select-option/task.md
2019-11-28 10:23:35 +07:00

22 lines
429 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.
Note, if you've done everything right, your alert should show `blues`.