填写文本框,更改使用javascript选择的下拉值 [英] fill the textbox on change of a dropdown value selected using javascript

查看:68
本文介绍了填写文本框,更改使用javascript选择的下拉值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

填写文本框,更改使用javascript

fill the textbox on change of a dropdown value selected using javascript

推荐答案

<select onchange="jsFunction()">
    <option>1</option>
    <option>2</option>
    <option>3</option>
</select>




function jsFunction(){
   // set text box value here
   var txt =  document.getElementById('txtBox');
   txt.value = "assign_here";
}









添加了 pre 标签。

[/ Edit]


你需要编写类似的Html代码:

you need to write Html code similar as:
<select Id="myDropdown">
    <option>1</option>
    <option>2</option>
    <option>3</option>
</select>

<input id="txtBox" type="text">



jQuery 代码为:


jQuery Code as:


(#myDropdown)。change(function(){
var selectedValue =
("#myDropdown").change(function () { var selectedValue =


这篇关于填写文本框,更改使用javascript选择的下拉值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆