JSFiddle - React, Tailwind, and code Playground

by the94air

HTML

<select id="mySelect" name="case" onchange="handelChange();">
  <option value="1">One</option>
  <option value="2">Two</option>
</select>
<input type="text" id="myInput">

JavaScript

function copySelect(input, select) {
  input.value = select.options[select.selectedIndex].text;
}

var select = document.getElementById("mySelect");
var input = document.getElementById('myInput');

function handelChange() {
	copySelect(input, select);
}