Ipad + How to prevent the keyboard from popping up on jquery datepicker

守給你的承諾、 提交于 2019-11-30 12:21:12

Have you tried disabling the input field using HTML (so adding disabled="disabled")?

There is a option in HTML with let's you do this kind of thing:

readonly="true"

Add this to your input field element. It will sort of "disable" the input field, but still fires events when something is done with it (like clicking on it).


Check out W3Schools Readonly Attribute for more information.

That's how I managed to deal with this problem by making the browser think the user blured the input so it hides the keyboard before it has time to show :

$('blabla')
    .datepicker(
    {
        /* options */
    })
    .on('focus',function()
    {
        $(this).trigger('blur');
    });

Works well for me where many of the other solutions I found didn't !

The right answer tends to be the simplest one.

readonly="true"

Is the solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!