I'm currently in the process of setting up a table where each row contains unique values. Using a for loop, I am able to generate these rows and store them in an array. Now, my question arises when I consider modifying a particular value with the id "number" within the row stored at Row_Array[2]
. How can I accomplish this task efficiently using JavaScript or jQuery?
Below is an example of how I create and save the rows in my array:
var Row_Array = new Array();
var number_initiated_rows = 0;
for (var i = 0; i <= finalnumber; i++) {
newrow = "<tr><td id='number'>" + i + "</td><td><input class='segment' min='0' type='number' value='" + lengthx + "'></td></tr>";
// Storing the generated rows in the array
Row_Array[number_initiated_rows] = newrow;
number_initiated_rows++;
$('#table').append(newrow);
}
The table has been successfully created, but now I am looking to change the "number" value within Row_Array[2]
to something other than "i". Any insights on how I can approach this task effectively would be appreciated.