[html] How to detect when cancel is clicked on file input?

Here is my solution, using the file input focus (not using any timers)

_x000D_
_x000D_
var fileInputSelectionInitiated = false;_x000D_
_x000D_
function fileInputAnimationStart() {_x000D_
    fileInputSelectionInitiated = true;_x000D_
    if (!$("#image-selector-area-icon").hasClass("fa-spin"))_x000D_
        $("#image-selector-area-icon").addClass("fa-spin");_x000D_
    if (!$("#image-selector-button-icon").hasClass("fa-spin"))_x000D_
        $("#image-selector-button-icon").addClass("fa-spin");_x000D_
}_x000D_
_x000D_
function fileInputAnimationStop() {_x000D_
    fileInputSelectionInitiated = false;_x000D_
    if ($("#image-selector-area-icon").hasClass("fa-spin"))_x000D_
        $("#image-selector-area-icon").removeClass("fa-spin");_x000D_
    if ($("#image-selector-button-icon").hasClass("fa-spin"))_x000D_
        $("#image-selector-button-icon").removeClass("fa-spin");_x000D_
}_x000D_
_x000D_
$("#image-selector-area-wrapper").click(function (e) {_x000D_
    $("#fileinput").focus();_x000D_
    $("#fileinput").click();_x000D_
});_x000D_
_x000D_
$("#preview-image-wrapper").click(function (e) {_x000D_
    $("#fileinput").focus();_x000D_
    $("#fileinput").click();_x000D_
});_x000D_
_x000D_
$("#fileinput").click(function (e) {_x000D_
    fileInputAnimationStart();_x000D_
});_x000D_
_x000D_
$("#fileinput").focus(function (e) {_x000D_
    fileInputAnimationStop();_x000D_
});_x000D_
_x000D_
$("#fileinput").change(function(e) {_x000D_
    // ..._x000D_
}
_x000D_
_x000D_
_x000D_

Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to file

Gradle - Move a folder from ABC to XYZ Difference between opening a file in binary vs text Angular: How to download a file from HttpClient? Python error message io.UnsupportedOperation: not readable java.io.FileNotFoundException: class path resource cannot be opened because it does not exist Writing JSON object to a JSON file with fs.writeFileSync How to read/write files in .Net Core? How to write to a CSV line by line? Writing a dictionary to a text file? What are the pros and cons of parquet format compared to other formats?

Examples related to input

Angular 4 - get input value React - clearing an input value after form submit Min and max value of input in angular4 application Disable Button in Angular 2 Angular2 - Input Field To Accept Only Numbers How to validate white spaces/empty spaces? [Angular 2] Can't bind to 'ngModel' since it isn't a known property of 'input' Mask for an Input to allow phone numbers? File upload from <input type="file"> Why does the html input with type "number" allow the letter 'e' to be entered in the field?