Prototypejs Javascript原型使用掩码按名称选择元素

Prototypejs Javascript原型使用掩码按名称选择元素,prototypejs,Prototypejs,我有几点意见: <input name="row.type[0].value"> <input name="row.type[1].value"> .... <input name="row.type[100].value"> 如果将类添加到所有输入字段,则可以使用该类访问它们 比如说 <input class="rowvalues" name="row.type[0].value"> <input class="rowvalues" na

我有几点意见:

<input name="row.type[0].value">
<input name="row.type[1].value">
....
<input name="row.type[100].value">

如果将类添加到所有输入字段,则可以使用该类访问它们

比如说

<input class="rowvalues" name="row.type[0].value">
<input class="rowvalues" name="row.type[1].value">
....
<input class="rowvalues" name="row.type[100].value">

如果要获取的所有输入的名称都以
行开头。键入[
,则可以使用
$$()
如下方式获取它们:

var cabins = $$('input[name^="row.type["]');
var cabins = $$('.rowvalues').each(function(row){
    //other code
    //row equals the DOM element not the input value
});
var cabins = $$('input[name^="row.type["]');