How can I use the "Go" or "Submit" button on a mobile software keyboard in an HTML5 application?

Mobile devices with software keyboards often change keyboards when filling out a web form, so that the user can submit with one click and avoid dragging the submit button on the form.

How can I access this function from the phonegap / cordova / other HTML5 application?

I struggled with this for a while, so share this answer.

+6
source share
1 answer

This Matt Nunes blog post showed me that type="submit" input should be the first button on the form.

Once you know this, you can be satisfied, but I wanted to hide the button - why do I need this when you want the user to use his keyboard? For a brief description of how to do this, check out this related question - Is it too much to ask to have an invisible button on jQuery Mobile?

Effectively, when the user presses the "go" button on his soft keyboard, it is displayed in the browser as click on the submit button. Consequently,

(1) Cancel the default event

(2) Profit.

Hope this helps someone.

+6
source

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


All Articles