Rows and lines defining | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Rows and lines defining

I'm trying to highlight the rows and lines of each number when it's pressed. But some of the numbers highlight the wrong lines/rows. How can I fix it? https://code.sololearn.com/WbSzkt2tDa9J/?ref=app UPDATE: fixed it by searching by the index of the html element instead of searching by the numbers (due to repeating numbers/values).

13th Oct 2018, 10:50 AM
Ido Hager
7 Answers
+ 3
You can store the element index as a user defined data on the tr dom element. Retrive it to access the array getting line and row that way. https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
13th Oct 2018, 11:39 AM
John Wells
John Wells - avatar
+ 4
One last issue would be picking the row or line element as the blue is changed to red. You may or may not want this behavor.
13th Oct 2018, 11:46 AM
John Wells
John Wells - avatar
+ 2
Part of your issue is you start with line on 27 & finish with row on 29 and reverse it for 31 & 33. Both usages in the pair should be the same. The rest of your issue is duplicate table values. Your search for the value will find the wrong one.
13th Oct 2018, 11:32 AM
John Wells
John Wells - avatar
+ 1
Thank you very much!
13th Oct 2018, 11:42 AM
Ido Hager
+ 1
Yes I was going to fix that after I fix the row and lines issue👍
13th Oct 2018, 11:48 AM
Ido Hager
0
I don't know exactly but I noticed that same numbers has same row line
13th Oct 2018, 11:20 AM
Daniele Bonomi
Daniele Bonomi - avatar
0
how can I fix the duplicate table values issue?
13th Oct 2018, 11:36 AM
Ido Hager