Reputation: 67
Is it possible to show/hide the soft keyboard programmatically for Cordova/Phonegap?
Upvotes: 3
Views: 15029
Reputation: 5848
The keyboard shows and hides itself based on input focus, in jQuery ...
// Show keyboard:
jQuery('#some-input-id').focus();
// hide keyboard:
jQuery('input, textarea').blur();
No plugin required.
Upvotes: 2
Reputation: 63
If the plugin is not working for you, maybe you can play with jquery .focus()
and .blur()
to show/hide the keyboard.
For example, the keyboard will show when an input is on focus
, and to lose the focus you can call blur
, and the keyboard will hide.
Upvotes: 4
Reputation: 64694
If you aren't using ionic, you may have luck with this plugin. The Keyboard object is attached to the window, so the API is a little different.
window.Keyboard.show();
window.Keyboard.hide();
It's also worth noting that on iOS only the hide method works. There is no way to manually open the keyboard without having a focused input.
Upvotes: -1
Reputation: 1861
You can use this plugin https://github.com/ionic-team/ionic-plugin-keyboard
This plugin has two methods
cordova.plugins.Keyboard.show
cordova.plugins.Keyboard.close
Upvotes: 2