I'm trying to create a loop that will put values from inputs in an array.
The point is that I have 81 inputs and their ids are "cells-[x]".
What I tried to do is
<script type="text/javascript">
var test = [];
for(i=0;i<80;i++){
test[i]=(document.getElementById('cell-[i]').value);
}
</script>
but it's not working.
B.T.W, I might have made a mistake in the for loop itself, but it is not my point(i'm only a beginner).
testvariable doesn't need an iterator unless you want 81 variables. Dovar test = document.getElementById('cell-' + i).valuevar test = document.getElementById(`cell-${i}`).valueHTMLInputElements) and iterate over those. Food for thought.getElementById(cell-${i})instead.getElementById(`cell-[${i}]`)