I have several inputs:
<input name="row.type[0].value">
<input name="row.type[1].value">
....
<input name="row.type[100].value">
How can I to obtain an array with all these inputs?
If with $$-operation, then something like that doesn't work:
var cabins = $$('input[name^=row.type[].value]').each(function(row) {
//stuff
});
If all the inputs you want to grab have a name starting with row.type[, then you can grab them all using $$() like this:
var cabins = $$('input[name^="row.type["]');
if you add a class to all of the input fields you can access them using the class
for instance
<input class="rowvalues" name="row.type[0].value">
<input class="rowvalues" name="row.type[1].value">
....
<input class="rowvalues" name="row.type[100].value">
then using $$()
var cabins = $$('.rowvalues').each(function(row){
//other code
//row equals the DOM element not the input value
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With