Customize input type=file behavior

html, javascript, jquery

Solution

$('input[type="file"]').click(function(){
    return confirm("Are you sure you want to see me dance?");
});

Live DEMO

Problem

I have a file browser on my page using ``` <input type="file" /> ``` Now on click of the browse button, I need to show a JS "confirm" popup. Only on click of "OK" on that popup, I should show the file browser, else it should just cancel (not display the file browser/selector window) Is it possible to achieve this?

Original source