What is a workaround for sharing file inputs?

As you already know, the Internet Explorer onchange fundamentally violated to version 9. Instead of triggering when changing, it onchange when the input field loses focus and has changes.

This will lead to various workarounds for checkboxes and radio buttons (instead of โ€œuse onclick โ€) and text fields (โ€œuse keyup insteadโ€).

However, I have this problem for entering a file, and I cannot understand what I am doing to receive a notification that a new file was selected immediately after that, and not when the user clicks elsewhere. I cannot attach myself to a mouse event because it is not connected to a mouse; and I cannot attach myself to a keyboard event, because it is also not related to the keyboard.

I would like to use IE-specific things if it can solve the problem.


Additional Information:

I am using jQuery 1.6 and the live method to attach an event.

 $(".upload").live("change", function() { /* stuff here */ }); 
+6
source share
1 answer

Use the onFocus event, combined with validation, to verify that there is a value. This works because after the user selects the file and the OS file selection dialog box is deleted, the focus returns to the input element.

+3
source

Source: https://habr.com/ru/post/895798/


All Articles