<input type="file">, 点击出现对话框,有无办法监听到用户点击对话框中取消按钮的事件?望大神赐教。
大家讲道理2017-06-13 09:26:15
If I remember correctly, there will also be onChange when clicking cancel, and the value should be undefined.
为情所困2017-06-13 09:26:15
onchange can be detected by clicking Cancel on Chrome, but not on Firefox. If your project is only on mobile devices, you can try onchange like this. If you want to consider PC, you can bind an additional click event specifically for detection. When onchange is triggered, you can ignore click. When click is triggered, but onchange is not triggered or the same file is selected, it means that the user has not Change the file selection or click Cancel. . .