I am attempting to create an array called userRow{} by using:
$('#divResults tr').find('td:nth-child(2)').text();
This will fetch 12 first names from a column in an HTML table, such as John, Dave, and so on.
$('#divResults tr').find('td:nth-child(3)').text();
Similarly, this line retrieves middle names, etc.
Here's what I have tried:
for (var i = 0; i < 12; i++) {
userRow[i]['jurorFN'] = $('#divResults tr').find('td:nth-child(2)').text();
userRow[i]['jurorMN'] = $('#divResults tr').find('td:nth-child(3)').text();
userRow[i]['jurorLN'] = $('#divResults tr').find('td:nth-child(4)').text();
}
However, this code does not output anything to the console.
My goal is to iterate through all the items in the table and, for example, if I alert userRow[1], it should display Dave, M, Johnson (first middle last) and so on.