开发者社区 问答 正文

禁用滚动同时禁用了输入

有一个iphone 网页应用,使用javascript来 禁用 滚动或者选择:
`document.ontouchstart = function(e){

e.preventDefault();

}`
我发现代码同时 禁用 了输入表单:
<input type="text" />
在这里点击的时候,键盘弹不出来。

展开
收起
小旋风柴进 2016-03-17 10:10:37 1952 分享 版权
1 条回答
写回答
取消 提交回答
  • document.ontouchstart = function(e){
      if(e.target.type == 'text'){
    
      }
      else {
        e.preventDefault();
      }
    }

    检测目标事件是不是文本输入

    2019-07-17 19:04:36
    赞同 展开评论