force keyboard open on android

前端 未结 1 1833
慢半拍i
慢半拍i 2021-02-13 00:19

does anybody knows how to force keyboard open on android browser (4.0 - maybe less)? i tried this solution and it does not worked for me.

in project i am trying to get a

1条回答
  •  被撕碎了的回忆
    2021-02-13 01:06

    Android pulls up soft keyboard whenever text input field is in focus. "Go" or "Done" button on Android works as form submit, therefore input text looses focus and keyboard disappears. User expects the keyboard to disappear after "Go", "Done" or "Enter" is pressed - so Android follows this rule. Forcing re-focus on field's blur will not do much since technically you moved to a different window.

    $('body').click(function() { $('#typer').focus(); }
    

    can provide a partial solution, whereby user has to click once anywhere in the body of the page for the typer to re-gain focus. It causes OS to move back to browser Activity and focus the input field. This fiddle shows it as an example: http://jsfiddle.net/Exceeder/Z6SFH/ (use http://jsfiddle.net/Exceeder/Z6SFH/embedded/result/ on your Android device)

    Other than writing a PhoneGap-like wrapper to control imeOptions of the keyboard, I am not aware of any solution that can solve this problem.

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