Can I trigger Android soft keyboard to open via javascript ( without phonegap )?

后端 未结 2 367
梦谈多话
梦谈多话 2020-12-09 04:47

I have some custom web components in my mobile web app, whereas I need to manually fire \'focus\' events on a field, to simulate the \'NEXT\' functionality in the Android so

2条回答
  •  萌比男神i
    2020-12-09 05:35

    Here's a link from StackOverflow:

    Showing Android's soft keyboard when a field is .focus()'d using javascript

    Just focussing without an event doesnt seem to work. - you DO need a click event triggering this.

    $(document).ready(function() {
        $('#field').click(function(e){
            $(this).focus();
        });
        $('#button').click(function(e) {
            $('#field').trigger('click');
        });
    });
    

提交回复
热议问题