I am having a problem getting the Android keyboard to show up when I focus a text input. I have this in my function that initializes the page:
jQuery(document).bind('pageshow', function()
{
jQuery($inputItemReference).focus();
jQuery($inputItemReference).prompt();
});
$inputItemReference is a variable that points to the input text box.
I was told that prompt() would show the keyboard. However, it does not. I am only getting the input to display the blinking cursor when the page loads. If I want the keyboard to be displayed, I have to tap the input again. I want the keyboard to be displayed right when the page loads. Any thoughts? Thanks.
If you are using cordova/phonegap add this to config.xml:
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
Based on this answer, Show virtual keyboard on mobile phones in javascript, it is not readily possible.
You can't, at least not in iOS (iPhone), and I believe Android as well. It's a usability issue that the keyboard should not be allowed to be triggered except by user input (it's just annoying if it's automatic).
There are a couple of ways I know of to get around this:
prompt()
opens the keyboard If you trigger the.focus()
from within a.click()
event (e.g. from opening your dialog), the keyboard shows up
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With