As a rule, the attribute value
is added to
list items. In this case, the value property of the
select will not contain the text option
, but
the value of its value
attribute.
Let's rewrite our select:
<select id="select">
<option value="1">one</option>
<option value="2" selected>two</option>
<option value="3">three</option>
</select>
Let's check what the selected value is now equal to:
select.addEventListener('change', function(){
console.log(this.value);
});
Make a dropdown list with the names of the days
of the week. As value
attributes of the
list items, add the numbers of the days of the
week from 1
to 7
. After changing
the list, display a message on the screen
indicating whether the selected day is a
weekend or a workday.