Is it possible to prevent the enter key from submitting forms, but allowing the enter key to work inside input. (E.g. textArea
newline)?
I tried so far:
e.preventDefault()
e.stopPropagation()
Both on the form tag onkeyup="if (e.keyCode == 13))"
This does prevent submission of the form on enter key, but it also prevents the enter key from working inside formfields completely.
What I want to achieve is, that when I press the enter key inside a TextArea, that it creates a newLine but when I hit enter in a input type="text"
that it doesn't submit the form.
Using JSF 2.3
JQuery solution is also ok.