IOS端日期插件选择时间弹出默认的‘完成’按钮

ios端的只读readonly属性不起作用,这个只读属性在安卓上可以阻止输入,所以键盘不会出现,但是在iphone中不兼容,就在iphone中加一个事件,为input添加聚焦事件,聚焦时触发document或自身失焦,或者是在input上添加聚焦时失焦事件

第一种:
$('#birthday').focus(function(){ 
  document.activeElement.blur();
})
第二种:
$('#birthday').on('focus', function(){
  $(this).trigger('blur');
});
<input type="text" name="birthday" id="birthday" readonly value="2020-04-01">

 

posted @ 2020-07-06 11:38  十三月凉  阅读(326)  评论(0编辑  收藏  举报
/* 看板娘 */