Answers for "defaultValue or value props on select"

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 "defaultValue or value props on select"

Browse Popular Code Answers by Language