2

Possible Duplicate:
JQuery .submit() Fails in IE9

http://jsfiddle.net/BayjF/8/

This piece of Jquery doesn't work in IE:

$('div#photoCropContainer').click(function() { 
    $('input#file').trigger('click'); 
}); 

In the JSFiddle on IE9 - if you click browse button, then submit fires automatically.

If however you click 'click me!' and choose a file the submit doesn't fire.

It appears the issue is with the .trigger() on IE9 - anyone have any ideas or advice?

thx

Community
  • 1
  • 1
Adam
  • 19,932
  • 36
  • 124
  • 207

1 Answers1

4

Yes, it is a security limitation in IE.

You should use a <label> around your input (or using for="file" attribute). Clicking on the label will automatically trigger click event on your input, thus opening the file chooser.

Guillaume Poussel
  • 9,572
  • 2
  • 33
  • 42
  • 3
    This does not work for me, it opens the file choose but then I have the same problem as above; the submit does not work correctly. In IE9. – sync Nov 15 '12 at 23:53