Store textbox input to an array


This Content is from Stack Overflow. Question asked by koizumi

I want to store all the input data of the textbox to an array with unique index number each so I can control them. The problem is that it only assigns zero index for all of them.

todoField.addEventListener('keypress', function (b) {

if (b.key === 'Enter' && todoField.value != 0) {
    let newtodo = todoField.value
    task = [newtodo]



Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?