HTML Guide for multiple
The multiple attribute is used to indicate that multiple options can be selected in a <select> element. As a boolean attribute, it should only be declared without any value.
Instead of:
<select multiple="true">
You should use:
<select multiple>
Here is an example of the correct usage of the multiple attribute:
<label for="colors">Select your favorite colors:</label>
<select id="colors" name="colors" multiple>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="yellow">Yellow</option>
</select>
A <select> element can only have multiple <option selected> if it includes the multiple attribute.
A <select> element represents a control that provides a menu of options. By default, only one option can be selected at a time unless the multiple attribute is present, allowing users to select more than one option. If multiple <option> elements use the selected attribute without multiple, this violates the HTML standard and triggers a validation error.
Example of incorrect usage:
<select name="color">
<option value="red" selected>Red</option>
<option value="green" selected>Green</option>
<option value="blue">Blue</option>
</select>
Correct usage with only one selected option:
<select name="color">
<option value="red" selected>Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
Correct usage for multiple selected options with multiple attribute:
<select name="color" multiple>
<option value="red" selected>Red</option>
<option value="green" selected>Green</option>
<option value="blue">Blue</option>
</select>
Remove duplicate selected attributes unless multiple is set, or add the multiple attribute if multiple selection is intended.