Get element by id returns null | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Get element by id returns null

The issue is the following: I have an array with string-type coordinates (‘1_1’) for example, from 0_0 to 3_3 if want to get the element by the id contained in the array it returns null, the array is not null, also if i write the coordinate statically it works. i added the Ids with innerHTML because i have to create the table depending on the rows and colums selected. (Dom is loaded) Check the following to visual support https://drive.google.com/drive/folders/1-4CIk1LYCay6Q8rA0rLds1JcovdBDf3K

13th May 2022, 11:22 PM
Alfonso Ortega
Alfonso Ortega - avatar
1 Answer
+ 1
Try to check sequence[0] value console.log(sequence[0]); console.assert(sequence [0]==='0_0', "sequence [0] is not equal to '0_0'");
14th May 2022, 12:14 AM
Calviղ
Calviղ - avatar