input focus in jquery mobile, but keyboard doesn't appear

后端 未结 5 2243
轻奢々
轻奢々 2020-12-30 22:33

I\'m using jquery,jquery mobile and phonegap. I want to show the keyboard one this page with input type=\"text\".

    
5条回答
  •  一个人的身影
    2020-12-30 22:40

    i use this in cordova 6 for android mobile app and its works:

    -install cordova plugin keyboard: cordova plugin add cordova-plugin-keyboard

    -then u can use Keyboard.show() to show keyboard and keyboard.hide() to hide it

    • u can do this to show keyboard:

        $("#your_text_input").click(function () {
                      $(this).focus();
                      Keyboard.show();
        });
      
        $('#your_text_input').keydown(function(e) {
        if (e.which == 13) { //Enter keycode
          //your action
          ...
      
          // Now clear input and set focus back to input
          Keyboard.hide();
          $(this).val('').trigger("keyup").focus();
        }
        });
      

提交回复
热议问题