开发者

File input javascript event, is there an event fire when someone click okay on the dialog box?

开发者 https://www.devze.com 2022-12-27 02:26 出处:网络
When someone click on Browse for the input file below: <input type=\"file\" name=\"blah\" /> A dialog box will appear. The user will then select a file and click \'Ok\'. The dialog box will c

When someone click on Browse for the input file below:

<input type="file" name="blah" />

A dialog box will appear. The user will then select a file and click 'Ok'. The dialog box will close. Is there an event fire because of that? I tried onfocus and onblur, it didnt work out.

The only way I can think of is to start a timer to check th开发者_如何学编程e value content when it is onfocus. Not that elegant. Any solution?

Cheers, Mickey


I think you can try to listen for an "onchange" event on your element.

The only drawback with this is if the user selects the same file using "browse" twice, it wont fire as the contents didnt change but I dont know if that is a requirement in your case.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号