Based on my code I want to push each row\'s inputs to each array. If it is row1, it should push all the input values of row 1 to array a1
. The second row\'s inputs
I think you mean this.
I tried to stay as close to your code as possible to not scare you off JavaScript
$('#check').click(function(event){
event.preventdefault;
var a=[];
$("[id^=row]").each(function() { // for each row
var idx = a.length; // find how many entries in a
a[idx]=[]; // add a new array
$(this).find("td input").each(function(i) { a[idx].push(this.value); }); // fill the array
});
var output = ""; // initialise a string
for (var i=0;i ";
}
$('#output').html('Pushed arrays:
'+output);
});
1
1