chrome中没有触发输入文件onchange事件 [英] input file onchange event not being fired in chrome
问题描述
任何人注意到
这是Chrome的一个已知功能,并且快速 Google的话题将带来一些有趣的讨论。
对我来说,更改
事件不会触发,因为没有任何变化(您选择相同的文件)
至于你的问题,你到底是什么问?您是否正在寻找一种改变这种行为的方法,或者您只想知道我们是否也注意到了这一点?
如果您想要绕过此行为,可以简单地在您的Javascript中创建一个新的文件输入并替换前一个。这样您的更改
事件是必须触发的。
This is a weird thing i noticed in chrome. if the user select a file and then select the same file again bu opening the file dialog again, chrome doesn't fire the onchange event while firefox does.
anybody noticed it as well?
This is a known feature of Chrome and a quick Google on the topic will bring up some interesting discussions.
It makes sense to me that the change
event wouldn't fire since nothing has changed (you're selecting the same file)
As for your question, what exactly are you asking? Are you looking for a way to change this behaviour or do you just want to know if we've noticed this as well?
If you want a way around this behaviour you can simply create a new file input in your Javascript and replace the previous one. This way your change
event is guarenteed to fire.
这篇关于chrome中没有触发输入文件onchange事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!