相关疑难解决方法(0)

为什么iPhone的Safari触发器不会在输入类型=文件上更改事件?

有一个iPhone,需要捕获change隐藏输入事件.在PC上打开时,它可以工作,我看到了changed文字.如果我在iPhone上打开它,它不会按预期工作,我只是看到open dialog.

简单的jsfiddle演示了这一点.

<input type=file style="display:none" id=file>
<button type=button id=but>open</button>

<div id=out>
</div>
Run Code Online (Sandbox Code Playgroud)

$(document).ready(function(){
  $('#but').on('click touchend', function(){
    $('#out').text('open dialog'); 
    $('#file').click();
  });
  $('#file').on('change', function(evt) {
    $('#out').text('changed');
  });
});
Run Code Online (Sandbox Code Playgroud)

它出什么问题了?这是iOs的新bug吗?Afaik,它仅在一个月前发挥作用.

我试图取代hiddenopacity:0,它可以用于简单的jsfiddle,但在复杂的项目,隐藏侧边栏不起作用.问题如下.如何进行简单的修复和最近发生的变化(一些Safari更新?),导致隐藏输入行为的变化?

javascript iphone jquery ios

7
推荐指数
1
解决办法
3563
查看次数

标签 统计

ios ×1

iphone ×1

javascript ×1

jquery ×1