Is it possible to link cells of the html table to array elements in js? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to link cells of the html table to array elements in js?

26th May 2020, 8:05 PM
Сергей Куликов
Сергей Куликов - avatar
8 Answers
+ 1
getElementName?
26th May 2020, 8:07 PM
njay
njay - avatar
+ 4
Somewhat like this? It stores all the table cells https://code.sololearn.com/WEJ30RT9Qsj4/?ref=app
27th May 2020, 8:30 AM
Abhay
Abhay - avatar
+ 2
Сергей Куликов In case by "too much", you meant too much typing, I have knocked this up to demonstrate that it can be done with JS in under 15 lines. https://code.sololearn.com/WN3Qx40tpiO6/?ref=app
27th May 2020, 10:25 AM
Russ
Russ - avatar
+ 1
Would it work if you gave each table cell an id - something like id="td_x_y" where x and y are the row coordinate and column coordinate of your array?
26th May 2020, 9:18 PM
Russ
Russ - avatar
+ 1
Thanks everyone. I did not focus on the topic of creating containers in the course on JS from Sololearn. Now I understand what way to work in.
27th May 2020, 8:36 PM
Сергей Куликов
Сергей Куликов - avatar
0
I want to use a two-dimensional JS array to manage the contents of html table cells. Are there any known methods? Я хочу использовать двумерный массив js для управления содержимым ячеек html таблицы. Существуют ли какие-либо известные способы?
26th May 2020, 8:08 PM
Сергей Куликов
Сергей Куликов - avatar
0
njay, thanks for the tip. I think getElementsByTagName will work in my case. However, the problem is complicated by a two-dimensional array. I need to practice.
26th May 2020, 8:21 PM
Сергей Куликов
Сергей Куликов - avatar
0
Russ, I have a table 15x15 cells, it is too much to give an id to each.
27th May 2020, 7:12 AM
Сергей Куликов
Сергей Куликов - avatar