JSFiddle - React, Tailwind, and code Playground

HTML

<select id="test">
    <option value="1">first</option>
    <option value="2">second</option>
    <option value="3">Three</option>
</select>

<input type="button" onclick="getValue();" value="get value" />

JavaScript

function getValue() {
    var val = document.getElementById("test").value;
    document.getElementById('test').value='3';   
    alert(val);
}