如何使用JavaScript将select标记的值输出到文本字段 [英] how can I output the value of the select tag to the text field using JavaScript

查看:83
本文介绍了如何使用JavaScript将select标记的值输出到文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

展开 | 选择 | Wrap | 行号

推荐答案


如何输出值通过使用正确的属性,使用javascript
how can I output the value of the select tag to the text field using javascript



将select标记添加到文本字段中。 <输入> element始终为空,因此它没有 .innerHTML 属性!


另外,< option>元素没有名称(用于什么?)并且它们也没有改变(因此onchange属性毫无意义)。

by using the right properties. an <input> element is always empty, hence it does not have an .innerHTML property!

additionally, <option> elements do not have a name (what for?) and they also do not change (hence the onchange property is pointless).


我忘了删除选项名称...你能给出吗?一些示例代码将select tag中的值输出到textfield?请...非常感谢你的回复:)
i forgot to delete the option name... can you give some example code to output the value from select tag to textfield? please... and thank you very much for your response :)


你是否正在尝试这个:
Are you trying this:
展开 | 选择 | 换行 | 行号


这篇关于如何使用JavaScript将select标记的值输出到文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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