如何在文本框中选择选项值? (多个选择选项和文本框) [英] How to get select option value into text box? (More than one select option and text box)
本文介绍了如何在文本框中选择选项值? (多个选择选项和文本框)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前,我有以下代码。我想将select选项的值分配给文本输入。我不知道如何循环它,因为我有很多选择选项。
这是小提琴
例如,如果我选择
1.a 。= 4,1.b = 3,1.c = 2,1.d = 1,
然后我的文字输入那里会显示
1.
4 K
3 A
2 V
1 Ad
$ b每个问题都是$ b等等。谢谢。我尝试了我的代码,它只是检测到最后一列。
我尝试过:
Currently, I had the following code. I want to assign value of select option into text input. I don't know how to loop it as I got many of the select option.
Here is the fiddle
For example, if I select
1.a.=4 , 1.b=3 , 1.c=2 , 1.d=1,
then my text input there if will show
1.
4 K
3 A
2 V
1 Ad
and so on for every question.Thank you.I had tried my code and it just detect the last column.
What I have tried:
$('select[name=qtyQ5]').change(function() {
$('select[name=qtyQ5] :selected').each(function()
{
var $this = $(this).val();
$(".numQ5").each(function()
{
$(this).val($this);
});
});
});
推荐答案
('select [name = qtyQ5]')。change(function(){
('select[name=qtyQ5]').change(function() {
('select [name = qtyQ5]:selected')。 each(function()
{
var
('select[name=qtyQ5] :selected').each(function() { var
this =
这篇关于如何在文本框中选择选项值? (多个选择选项和文本框)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文