I am using backbone,marionette
for my Application.I used same code for both desktop and mobile
but keypress
not working in mobile
.I made a Jsfiddle for testing.
If you open this link in mobile
event not firing,If you open in desktop
it's firing.How can I resolve this.
can anyone help me.
Thanks.
Chrome mobile doesn't support keypress events properly for now. There is a long standing bug for this:
https://code.google.com/p/chromium/issues/detail?id=118639
I believe it should be fixed in v38.
Finally I found a problem,but it won't work in opera.Instead of writing the code for numeric fields.I just added an attribute type='number' to input field in html file.Now only numeric keypad is coming.So it satisfies my requirements.Here is the JsFiddle
html code:
I will suggest two events on input box.
This will work on desktop webbrowser.
1)
onkeypress = return isNumberKey(event);
This will work for mobile
2)
onkeyup="numberMobile(event);"
Apply both event on the input box and it will work.Only drawback is,It make it slow.But for now we have to live with it.
There is one issue woth this solution.Left navigation is not working.I will update more appropriate solution soon.
It seems like
keypress
event has been deprecated (Refer to https://developer.mozilla.org/en-US/docs/Web/Events/keypress) and it is better to usekeydown
event now before all browser drop support on it.Tested on browserstack. Seems to be working to me. Here's a link to your gist:
http://www.browserstack.com/start#os=android&os_version=4.1&device=Samsung+Galaxy+S+III&zoom_to_fit=true&full_screen=true&url=http%3A%2F%2Fjsfiddle.net%2F33Snz%2F3%2Fembedded%2Fresult%2F&speed=1&start=true
Can you let know what specific andriod device and browser you testing in.