enter image description here

There is such a small structure. I'm trying to li add a child div, but it doesn't work. If you replace dot.appendChi .. with any other, for example document.body, everything works. What could be the problem?

Closed due to the fact that off-topic participants Air , PashaPash 25 Nov '18 at 12:51 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Air, PashaPash
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    @Sergey, forcing someone to try to figure out your problems from the screenshot is not a good idea. The text can be copied and executed, and no one will rewrite the code from the screenshot. - ya.ymer Nov.

1 answer 1

Okay. What do you think is happening in the line where innerHTML is assigned?

 dot.innerHTML = i + 1; 

Anything that was inside the dot at this point will be destroyed.