Why can I not use 2 of the same input fields in a form, and the enter button submit the form
More detailed question
Straight to the point. I'm trying to use the
enter button to submit a form when an input element is focussed, which should then emit an event.
- I've written a codepen here which replicates the "weird" behaviour: https://codepen.io/anon/pen/gqGMmW
As you can see, if I have more than 1 input of the same type (for example, 2
input="text" inputs, when i press the
enter button when focuses on an input, it fails to emit the
In the second app example directly below it, I have the exact same form, with the exact same vuejs instantiation, but with only one input field, and when you press enter when focuses on that element it correctly emits the submit event.
I've tried to google what might be going on here, but struggling to find much of any use apart from "prevent form being submitted on enter".
I've tried adding an ID attribute, a
name attribute etc to the element, and it still doesn't work as expected.
I'm not beginner at vuejs, but not an advanced JS user either, so "simple" answers would be appreciated :D
If more information is needed, please let met know and I'll provide as much as I can