$('.this_add').click(function(){
$('.add_upload').append('<input type="file" name="file[]">');
$('input[type="file"]:last').click();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<button class="this_add">add</button>
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="image[]" />
<div class="add_upload"></div>
<input type="submit"/>
</form>
</body>
</html>
I have a scenario like the above snippet. If the user click add button then it will append an input type file into a <div class="add_upload>
then trigger a click event on it and if the the user click cancel or close
like this below image then the input type file will be remove.
I want to ask, is it possible to check click event on "cancel or close" on input type file in html with jQuery or Javascript ?