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

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

问题描述

当用户选择文件并关闭对话框后,我无法检测输入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天全站免登陆