jQuery <input> handle file select event

Description

jQuery <input> handle file select event

View in separate window

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Fire Event on File Select</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
    $(document).ready(function(){
        $("#myInput").change(function(){
            document.getElementById("demo").innerHTML = "A file has been selected.";
        });//from w  ww .j  av  a 2 s.c om
    });
</script>
</head>
<body>
    <p id="demo"></p>
    <form>
        <input type="file" id="myInput">
    </form>
</body>
</html>



PreviousNext

Related