将下拉列表框值分配给文本框 [英] assign a dropdownlist box value to textbox
本文介绍了将下拉列表框值分配给文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮助我在代码中为文本框分配一个下拉列表框值。
Can any one help me out in the code for assign a dropdownlist box value to textbox .
推荐答案
使用简单的javascript这可以实现如下: br />
using simple javascript this can be achieved like:
var e = document.getElementById("DropDownList");
var strText = e.options[e.selectedIndex].text;
document.getElementById('TextBox').value= strText;
或使用jQuery
or using jQuery
(' #TextBox')。val(
( #DropDownList选项:选择)。text());
("#DropDownList option:selected").text());
>
这篇关于将下拉列表框值分配给文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文