Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set defaultValue for select element jsx

<div>
      <select
        value={choice}
        defaultValue={"default"}
        onChange={(e) => setChoice(e.target.value)}
      >
        <option value={"default"} disabled>
          Choose an option
        </option>
        <option value={"one"}>One</option>
        <option value={"two"}>Two</option>
        <option value={"three"}>Three</option>
      </select>
      <h1>You selected {choice}</h1>
</div>
Source by www.google.com #
 
PREVIOUS NEXT
Tagged: #set #defaultValue #select #element #jsx
ADD COMMENT
Topic
Name
7+8 =