The form does not appear on the enter key when there is no submit button inside

is there any fix for this

<form>
<input type="text" ...

</form>

pressing the enter key inside the text field when there is no submit button inside does not send the form, is there any fix for this?

+3
source share
2 answers

My suggestion ... Create a submit button. If you don't want to show the submit button, then hide the button using CSS.

+6
source

You can use the keyup jquery event, and if key 13 is pressed (enter key code), submit the form:

$('#input-id').keyup(function(e) {
    if (e.keyCode == 13) {
        $('#form-id').submit();
    }
});
+2
source

Source: https://habr.com/ru/post/1752073/


All Articles