有一个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,它仅在一个月前发挥作用.
我试图取代hidden有opacity:0,它可以用于简单的jsfiddle,但在复杂的项目,隐藏侧边栏不起作用.问题如下.如何进行简单的修复和最近发生的变化(一些Safari更新?),导致隐藏输入行为的变化?