This commit is contained in:
Ilya Kantor 2017-03-18 14:46:13 +03:00
parent 1f61c2ab1d
commit af0ee2a49e
66 changed files with 12263 additions and 2059 deletions

View file

@ -1,24 +1,21 @@
Решение:
The solution, step by step:
```html run
<select>
<option value="Rock">Рок</option>
<option value="Blues" selected>Блюз</option>
<select id="genres">
<option value="rock">Rock</option>
<option value="blues" selected>Blues</option>
</select>
<script>
var select = document.body.children[0];
// 1)
var selectedOption = select.options[select.selectedIndex];
let selectedOption = genres.options[select.selectedIndex];
alert( selectedOption.value );
// 2)
var newOption = new Option("Classic", "Классика");
select.appendChild(newOption);
let newOption = new Option("classic", "Classic");
select.append(newOption);
// 3)
newOption.selected = true;
</script>
```