Reputation: 50790
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?
Upvotes: 4
Views: 314
Reputation: 9370
Just try this:
<input type="file" onclick="return confirm('Continue ?');"/>
Or make use of onclick event handler:
$('input[type=file]').click(function(){
return confirm("Continue ?");
});
Upvotes: 2