更新时间:2022-12-20 10:56:55
MSIE使用 onpropertychange - 事件,例如丰富: http://jsfiddle.net/7wR2L/14/
由于jQuery不支持此事件,您必须在不使用jquery(内联或使用attachEvent))的情况下进行分配。
在其他浏览器中,尝试使用突变 - 事件,也许他们会在那里工作。请参阅昨天关于突变事件的相关主题,以了解他们的工作原理:如何从Firefox扩展名捕获页面标题的更改
RE:
The above questions dealt with getting the 'change' event to fire consistently across browsers after a file selection has been made. This is has been resolved as evidenced by the example at http://jsfiddle.net/7wR2L/
My situation is a tad different. It seems this issue rears its ugly head in another context.
Based on design constraints, I have to use a non-file-input element ('a' tag) to trigger the "click" event on the file input element. So far from my tests, it looks like the file input is unable to fire a "change" notification when a file is selected in this way.
Please take a look at the example at http://jsfiddle.net/rudylattae/7wR2L/8/
Test environment(s):
Windows Server 2008 R2
Windows XP Pro (2002 - SP3)
With MSIE use the onpropertychange-Event, example: http://jsfiddle.net/7wR2L/14/
As jQuery does'nt support this event you have to assign it without jquery(inline or use attachEvent )
In other browsers try using mutation-events, maybe they'll work there. See a related topic on mutation-events from yesterday, to have a little example how they work: How to capture change on page title from a firefox extension