appendChild in for loop only adds 1 child

后端 未结 3 431
轻奢々
轻奢々 2021-01-05 10:38

In JavaScript I am creating a grid (the type of grid you see in Photoshop) with HTML tables. The grid size is going to be variable, i.e., changeable by the user, so the size

3条回答
  •  轮回少年
    2021-01-05 11:28

    You are appending the same element over and over. You need to call document.createElement each time you wish to have a new element.

提交回复
热议问题