How to hide keyboard on phonegap android

前端 未结 5 987
北荒
北荒 2021-01-19 07:14

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

相关标签:
5条回答
  • 2021-01-19 07:45

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

    use it like that:

    plugins.SoftKeyBoard.hide(function () {
        // success
    },function () {
       // fail
    });
    
    0 讨论(0)
  • 2021-01-19 07:49

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

    0 讨论(0)
  • 2021-01-19 07:49

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

    $('#datepicker').focus(function() {
      this.blur();
    });
    
    0 讨论(0)
  • 2021-01-19 07:50

    Alternatively you could use the new HTML5 input types.

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

    in Google Chrome i get the following:

    'Date' HTML5 input type

    0 讨论(0)
  • 2021-01-19 07:51

    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.

    0 讨论(0)
提交回复
热议问题