I have an an array that returns the values such as the following:
//Eg 1 [ [ "214323", "34243" ], [ "3333", "123" ] ]
//Eg 2 [ [ "214323" ],[ "3333" ] ]
I want to validate if the array holds only numbers with no spaces or null, else I would like to throw an error. This is my following code and it does not work in the above example. It throws out an error even though all values are numeric.
for (var i = 0; i <= arrayVals.length; i++) {
if(!(/^\d+$/.test(arrayVals[i]))) {
err_comp=true;
}
}
if( err_comp ==true) {
alert( 'The value has to be only numeric.');
}