iPhone Mobile Safari: Force keyboard open

后端 未结 5 1826
迷失自我
迷失自我 2021-02-05 00:52

This is an HTML / CSS / JS (jQuery) iPad app. I\'ve got a button, that slides down an input form. I\'d like to focus the user on the input, and then launch the keyboard.

<
5条回答
  •  感情败类
    2021-02-05 01:33

    Try:

    $('#element').blur().focus();
    

    or if that does not work:

    $('#element').focus().blur().focus();
    

    blur() eliminates the focus and focus() brings it back. For some reason, it works every time compared to focus() working once in a while on its own.

提交回复
热议问题