Answers for "Use the `defaultValue` or `value` props on <select> instead of setting"

1

Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.

<select defaultValue={'DEFAULT'} >
        <option value="DEFAULT" disabled>Choose a salutation ...</option>
        <option value="1">Mr</option>
        <option value="2">Mrs</option>
        <option value="3">Ms</option>
        <option value="4">Miss</option>
        <option value="5">Dr</option>
      </select>
Posted by: Guest on April-20-2021

Code answers related to "Use the `defaultValue` or `value` props on <select> instead of setting"

Browse Popular Code Answers by Language