I have a basic form with a search input and a submit button within. When focus takes place in the input, the keyboard is displayed as expected. When I press the button, the form submit event occurs, in which I call event.preventDefault() and instead make an ajax call. However, when I press the search button on the keyboard, the keyboard just hides and no submit event occurs.
Why doesn’t the form submit when I press search on the keyboard? How can I trigger this event to happen via the keyboard search button?
Thanks.
The keyboard search button must be bound to a keypress event and has the
keycodeof13.Basically, listen to
keypressevents and return all calls except fore.which === 13