本文介绍了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获取每个输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!