问题描述
我正在尝试学习一些jQuery,但当我在select标记中选择特定选项时,如何显示文本字段(当然是基于ID的)无法弄清楚.我已经用Google来解决我的问题,但还没有找到任何东西.在那里,我问你我该如何解决.见下文,我要它.
I'm trying to learn some jQuery and I can't figure it out, how to show a text field (ID-based of course) when I select a specific option in my select tag. I've Google'd for a answer to my problem, but I haven't find anything yet. There for I'm asking you how I can fix this. See below how I want it.
默认:
选择标签
-
选项1
Option 1
选项2
选项3
默认为隐藏的文本字段.
Text field which is hidden by default.
如果我选择选项1 ,则文本字段将保持隐藏状态.如果我选择选项2 ,则结果与第一个相同.如果我选择选项3 ,该文本字段将可见.如果我选择其他选项,请再次说出选项2 ,该文本字段将被隐藏.
If I choose Option 1, the text field remains hidden. If I choose Option 2 the result is the same as the first one. If I choose Option 3 the text field will be visible. If I choose another option, say Option 2 back again, the text field will be hidden.
希望您能理解我的意思:)
I hope you understand what I mean :)
谢谢.
推荐答案
查看以下内容: http://jsfiddle.net /a8ZWx/
您可以使用select元素的change
事件来决定是显示还是隐藏文本框.
You may use the change
event of the select element to decide whether to show or hide the text box.
这篇关于在特定选项上显示文本字段选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!