How to fire event on file select in jQuery

  1969 views   2 years ago jQuery

Use the jQuery change() method

You can simply use the jQuery change() method to fire an event to do something when the user select any file using the HTML file <input> type box.

Let's try out an example to understand how this method basically works:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery Fire Event on File Select</title>
<script src=""></script>
            alert("A file has been selected.");
        <input type="file" id="myInput">


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]