JSFiddle - React, Tailwind, and code Playground
by phrontisteries
HTML
<html>
<body>
<form>
Select your favorite browser:
<select id="myList" onchange="myFunction()">
<option></option>
<option>Google Chrome</option>
<option>Firefox</option>
<option>Internet Explorer</option>
<option>Safari</option>
<option>Opera</option>
</select>
<input type="text" size="50" id="nope" onchange="myFunction2()"><br>
<p>Your favorite browser is: <input type="text" id="demo" size="20"></p>
</form>
</body>
</html>
JavaScript
function myFunction() {
var mylist = document.getElementById("myList");
document.getElementById("demo").value = mylist.options[mylist.selectedIndex].text;
}
function myFunction2() {
var mylist = document.getElementById("nope").value;
document.getElementById("demo").value = mylist;
}