My original post is here: https://stackoverflow.com/questions/26090790/input-type-file-click-doesnt-work-on-ie8-9?noredirect=1#comment40885240_26090790 .

Originally, I was using $j('#file').click() in my event handler for $j('#file-wrapper').on('click', function()'. It works for other browsers but not ie8/9. And Chase mentioned his code works by using onclick() event. I tried it. It works well in jsfiddle: http://jsfiddle.net/qy9gLtzv/ . But it doesn't work for me at all after I pasted that into my VF page. So I am guessing whether it has anything to do with the meta-data in VF?


By clicking that link in my page, I am actually getting an error at Console: object expected. The screen shot: enter image description here

But I am not quite sure what it means. The syntax seems quite normal to me.

  • are you getting any errors in the javascript console in IE? Also are you loading all JS resources through apex:includescript with static resources or regular script tags? – Phil B Sep 29 '14 at 2:04
  • @PhilB I am pretty sure it loads all the resources because it was working for all other browsers. I am not seeing any error – Lance Shi Sep 29 '14 at 2:51
  • @PhilB Sorry I was actually getting an error after clicking that label. I will edit my post. – Lance Shi Sep 29 '14 at 3:03
  • are you using a jquery no conflict? In your other post you were using $j instead of $. If you aren't using noconflict try switching back to using it. – Phil B Sep 29 '14 at 13:17

The reason for this is not due to any meta data in VF page or any onclick stuffs in Javascript - it is because IE don't like the way of clicking on hidden input file tag. So it won't work.

To walkaround this issue, you need to unhide the <input type=file> tag and use absolute positioning to put it outside the browser window. And it will work fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.