Creating a new element with javascript

前端 未结 3 1311
时光说笑
时光说笑 2021-01-28 22:50

I\'m trying to create a new li element using a text input. The problem is while the text is appearing, it doesn\'t to create an actual li element that

3条回答
  •  伪装坚强ぢ
    2021-01-28 23:26

    You are appending text you need to append listItem. Check this out:

    Your code:

    list.appendChild(text);
    

    How it should be:

    list.appendChild(listItem);
    

    Best!

提交回复
热议问题