On a mobile phone, how do I get "enter" to submit a form inside input type = "number"?

I am using AngularJS and ng-submit as follows:

 <form ng-submit="submit(foo); foo='';"> <input type="number" ng-model="foo"> </form> 

In Chrome on the desktop, I can press enter while at the input to submit the form (which in this case calls submit(foo) ).

In Chrome for Android (KitKat), this does not work. BUT, if I change the input to type="text" , then it works when I click Go.

How can I make the form behave as it does for input type="text" with input type="number" ? I use type="number" because I want the device to call a numeric keypad.

Here's a plunkr that illustrates the problem: http://plnkr.co/edit/4WJfdoKgXu7o6ZsM8WFx?p=preview (or http://goo.gl/IiQzGf if you are on a mobile device).

Edit:

Listening to input using JavaScript does not work: http://plnkr.co/edit/07QGA1s4UCyop8IB8Dmx?p=preview

Edit 2:

This is not an AngularJS issue. This is the HTML issue: http://embed.plnkr.co/ZVD0ZtmEutWZr7P7vq2b/preview

+5
source share
1 answer

I tried the last plunker (plain HTML) on Android N on the Samsung Galaxy S8, and submit worked on both fields. This may be a problem with a specific version of Android.

0
source

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


All Articles