How to turn off iPhone keypad for a specified input field on web page

两盒软妹~` 提交于 2019-12-05 01:28:07

I haven't come across the way to hide keyboard. But have you thought alternate way of displaying "input". One option would be using <input type="month" /> which brings the native month picker in iOS5.

Second option would be styling eg. span element as input element (-webkit-appearance not working on iOS), and adding tabindex for the element. This could also work, although I'm not aware of the month picker you're using.

Third option - can't you prevent the validation process when blurring the field is triggered manually?

I had a same Issue in Drupal, where the input fields will be appending dynamically, so i added some js, checking for Iphone/Ipad and added "readonly" property

var checkUserAgent = navigator.userAgent;
    if (checkUserAgent.match(/iPad/i) || checkUserAgent.match(/iPhone/i)) {
        var checkBabyId1 = $('#babys_due_date_id').length > 0;
        if (checkBabyId1 == true) {
            $('#babys_due_date_id').find('input').prop('readonly', true);
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!