Select option in HTML sets selected = "selected" to an invalid solution. optionselected
Today, I encountered a strange problem. I had a select control when I wrote HTML. The selected = "selected" by setting option is invalid, but it is acceptable in other browsers. I asked Google's great god, addAutocomplete = "off", for example:
<Select autocomplete = "off">
<Option> Yes </option>
<Option selected = "selected"> NO </option>
</Select>
This is OK! In the future, we need to develop a good habit. It is safe to add autocomplete = "off" to each select tag.
Question about setting the selected attribute in the select drop-down box
Write all the options in <option> to the database and then read them directly. The last statement can be used to determine whether selected is added.
<Select> when selected = "selected" is set, which of the following is helpful? Khan is in a rush.
You can use cookies to remember the selected value.