jQuery change() 的任何替代方法来检测用户何时通过 IE8 中的对话框选择新文件? [英] Any alternative to jQuery change() to detect when user selects new file via dialog box in IE8?

查看:10
本文介绍了jQuery change() 的任何替代方法来检测用户何时通过 IE8 中的对话框选择新文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用户选择文件并关闭对话框后,我无法检测到 input type="file" 何时更改其值.

I am unable to detect when input type="file" changes its value after user selects file and the dialog box closes.

$('.myInput').change(function(){
    alert($(this).val());
})

以上 jQuery 代码在除 IE 之外的所有浏览器中都能完美运行.出于某种原因,IE 仅在输入字段失去焦点后才检测到更改.

Above jQuery code works perfectly in all browsers apart from IE. For some reason IE detects the change only after input field loses focus.

有没有办法在对话框关闭后立即检测更改?或者在对话框关闭后强制输入字段失去焦点以便 IE 可以检测到它?

Is there a way to detect the change immediately after dialog box closes? Or maybe to force input field to lose focus after dialog box closes so IE can detect it?

我很困惑.感谢您的帮助.

I'm puzzled. Thanks for any help.

推荐答案

这个 是一个已知错误 已作为 jQuery 1.4.2 版本 的一部分解决,1.4.2 获得重大事件模型重写这是修复的一部分,只需升级即可解决问题:)

This was a known bug that was resolved as part of the jQuery 1.4.2 release, 1.4.2 got a major event model re-write and this was fixed as part of that, just upgrade to resolve the problem :)

这篇关于jQuery change() 的任何替代方法来检测用户何时通过 IE8 中的对话框选择新文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆