更新时间:2022-12-09 17:08:37
是的.我的 Chrome 与 Firefox 的行为不同,但我认为 Chrome 是正确的.
Yes. My Chrome has different behavior to Firefox, but I think Chrome is correct.
根据 W3C 的文档:
onchange 事件发生在控件失去输入焦点并且其值在获得焦点后被修改时发生
onchange event occurs when a control loses the input focus and its value has been modified since gaining focus
如果你尝试上传同一个文件,文件输入的值不会改变.尝试打印出来:
if you try to upload the same file, the value of file input does not change. Try to print it out:
$('.button-2').click(function(){
console.log($(".list .upload-file").val())
return false;
});