Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how-to get selected value of a dropdown menu in reactjs

....
const [currentValue, setCurrentValue] = useState(2);
<select id = "dropdown" value={currentValue} defaultValue={currentValue}>
     <option value="N/A">N/A</option>
     <option value="1">1</option>
     <option value="2">2</option>
     <option value="3">3</option>
     <option value="4">4</option>
  </select>
.....

setTimeut(()=> {
 setCurrentValue(4);
}, 4000);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #selected #dropdown #menu #reactjs
ADD COMMENT
Topic
Name
9+3 =