我有这个代码可以在文本框中显示下拉值。实际上,当我从文本框中的下拉列表中选择一个值时,会显示一个值。如何修改以显示选项文本 insted 值?
<select id="Ultra" onchange="run()">
<!--Call run() function-->
<option value="0">Select</option>
<option value="8">text1</option>
<option value="5">text2</option>
<option value="4">text3</option>
</select>
<br>
<br>
TextBox1
<br>
<form>
<input id="srt" placeholder="get value on option select" type="text">
<br>
TextBox2<br>
<input id="rtt" onkeyup="up()" placeholder="Write Something !" type="text">
<script>
function run() {
document.getElementById("srt").value = document.getElementById("Ultra").value;
}
function up() {
//if (document.getElementById("srt").value != "") {
var dop = document.getElementById("srt").value;
//}
pop(dop);
}
function pop(val) {
alert(val);
}
</script>
</form>