How to hide keyboard on phonegap android

匿名 (未验证) 提交于 2019-12-03 02:31:01

问题:

I am using 1.0 PhoneGap for android. I have an application form with several fields, one of them is to put the anniversary. I put a datepicker that field, yet when you click on the field, the keyboard appears. how can I disable the keyboard?

Code as below :

<label> Date: </label> <input id="datepicker" type"text" name="date"/> 

回答1:

You can mark the input field as read only and then create a function for an onclick event to display the datepicker.



回答2:

Not sure what JS library you're using, but in jQuery, you'd do:

$('#datepicker').focus(function() {   this.blur(); }); 


回答3:

If you need to hide keyboard on android you can use this plugin

use it like that:

plugins.SoftKeyBoard.hide(function () {     // success },function () {    // fail }); 


回答4:

Alternatively you could use the new HTML5 input types.

<input type="date" name="bday" /> 

in Google Chrome i get the following:



回答5:

This worked for me and saved my head from excessive scratching!

var hideKeyboard = function() {     document.activeElement.blur();     $("input").blur(); }; 

The solution was found here, where you can find a non jQuery solution.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!