Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which browsers support triggering click event on input[type="file"] elements?

According to https://developer.mozilla.org/en/Using_files_from_web_applications,

Starting in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) , you can hide the admittedly ugly file element and present your own interface for opening the file picker and displaying which file or files the user has selected.

With something like this (using jQuery):

$('a.upload').click(function(e) {
  e.preventDefault();
  $('input[type="file"]').click();
});

I am not asking what other ways there are to do this better. I am wondering what other browsers support the click event for input file just like this?

like image 341
Jon Derring Avatar asked Oct 26 '11 15:10

Jon Derring


1 Answers

firefox 3.2+ versions do not support AFAIK because there is some security issue if the file input is hidden, chrome and ie support that I guess that's why people trigger the click putting the file input directly behind the fake elements

like image 168
Mr. BeatMasta Avatar answered Nov 03 '22 09:11

Mr. BeatMasta