HTML, JavaScript

Handle Cancel Click on File Input

0 6500

Ever Tried capturing cancel event on Browse file input type in HTML, tbh there is no direct way to do so :(

But there is a workaround adding a bit of javascript. We can play with onfocus event of the BODY element.

Handle Cancel Click on File Input

Handle Cancel Click on File Input

Example ->
HTML

 

Javascript

See it working here

About the author / 

trishul

Related Posts

Leave a reply

Your email address will not be published. Required fields are marked *