I am trying to make a input field that submits when enter is pressed. When I try to use the submit() function I get the default page reset. I don't know how to cancel this. I have tried to use a event listener for submit and even passing a anonymous function into submit() but neither seems to work.

```js
addTask.oninput = () => {
    window.onkeydown = (key) => {
        if (key.keyCode === 13) {
            newTaskForm.submit()
            console.log(newTaskForm.addTask.value)
        }
    }
}

```

PS: if u think it is one of those I have already tried please say so. could have just messed up some syntax.