Skip to content

Form properties and methods #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
The solution, step by step:
Рішення, крок за кроком:

```html run
<select id="genres">
<option value="rock">Rock</option>
<option value="blues" selected>Blues</option>
<option value="rock">Рок</option>
<option value="blues" selected>Блюз</option>
</select>

<script>
Expand All @@ -12,7 +12,7 @@ The solution, step by step:
alert( selectedOption.value );

// 2)
let newOption = new Option("Classic", "classic");
let newOption = new Option("Класика", "classic");
genres.append(newOption);

// 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ importance: 5

---

# Add an option to select
# Додайте нову опцію до елемента `<select>`

There's a `<select>`:
Маємо `<select>`:

```html
<select id="genres">
<option value="rock">Rock</option>
<option value="blues" selected>Blues</option>
<option value="rock">Рок</option>
<option value="blues" selected>Блюз</option>
</select>
```

Use JavaScript to:
Використовуючи JavaScript:

1. Show the value and the text of the selected option.
2. Add an option: `<option value="classic">Classic</option>`.
3. Make it selected.
1. Виведіть значення та текст обраної опції.
2. Додайте опцію: `<option value="classic">Класика</option>`.
3. Зробіть її обраною.

Note, if you've done everything right, your alert should show `blues`.
Зверніть увагу: якщо ви все зробили правильно, то ваше сповіщення має показати значення `blues`.
Loading