0
Display not working
Please can someone help me. I want the timer to start and display in the first element of the inner divs when the inner HTML of the parent of the inner div matches the random number and restarts every time this condition is Met. It's not displaying https://code.sololearn.com/WMRLBJTV5rw4/?ref=app
1 Respuesta
0
in line where you are assigning display .
you used i instead of l . l is used in the loop condition. and to select id add #
childDiv.querySelector("inner-div-" + i + "-0")
change it to:
childDiv.querySelector("#inner-div-" + l + "-0")
in line :
if (child.innerHTML == randomNumber) {
you are comparing a number with an html element.
it should be:
if (child.innerText == randomNumber) {
Text instead of HTML.
adjust this loop to include the last row
for (var i = 0; i < 10; i++) {
randomNumber = Math.floor(Math.random() * 10);
10 instead of 9