I know there is a way of accessing sequential elements, but I’m not sure how to access them by index. Is there a way to do it?
I’m looking for something like:
document.getElementById('table1').cell[1]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To access a cell by its row index and cell index within that row you can use:
This will access the second cell (index 1) in your first row (index 0)
If you want to just use cell index (and not keep track of rows) and have it iterate through the cells in each row, you can do this, but only if every row has the same number of cells. The following code would access the fourth cell in the table (index 3) whether it’s in row 0, 1, or 3; as long as each row has the same number of cells: