PrototypeJS获取每个输入的值 [英] PrototypeJS get value of each input
本文介绍了PrototypeJS获取每个输入的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写下面的函数来读取来自我的 fieldset
的输入,它可以工作,但我不知道如何读取 value code> input
$$('#split_edit div label input')。 (
函数(item){
console.log(item);
}
);
这是我的html结构,我无法使用ID读取输入值,因为它们是动态生成的。
< fieldset id =split_edit>
< div class =top-10>
< label>
< span class =span-3 left>第1项(%)< / span>
< input type =textclass =textname =packet_1value =0id =packet_3>
< / label>
< / div>
< div class =top-10>
< label>
< span class =span-3 left>第1项(%)< / span>
< input type =textclass =textname =packet_2value =0id =packet_7>
< / label>
< / div>
< / fieldset>
如何从选择的输入中选择值 PrototypeJS中的函数?
对于显而易见的问题,我很遗憾,但是几个小时前我已经开始使用PrototypeJS了。
解决方案使用
item.value
: $ $('#split_edit div label input')。each(function(item){
console.log(item.value);
});
I write following function to read inputs from my fieldset
, it works but I have no idea how to read value of selected this way input
$$('#split_edit div label input').each(
function(item) {
console.log(item);
}
);
This is my html structure, I can't read input value using its ID because they are dynamically generated.
<fieldset id="split_edit">
<div class="top-10">
<label>
<span class="span-3 left">Item 1 (%)</span>
<input type="text" class="text" name="packet_1" value="0" id="packet_3">
</label>
</div>
<div class="top-10">
<label>
<span class="span-3 left">Item 1 (%)</span>
<input type="text" class="text" name="packet_2" value="0" id="packet_7">
</label>
</div>
</fieldset>
How to select value from input selected by each
function in PrototypeJS?
I'm sorry for obvious question but I have started using PrototypeJS several hours ago.
解决方案
Using item.value
:
$$('#split_edit div label input').each(function(item) {
console.log(item.value);
});
这篇关于PrototypeJS获取每个输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文