How to imitate click on file input?

CSS: div.fileinputs { position: relative; } div.fakefile { top: 0px; left: 0px; z-index: 1; cursor: pointer; } .fileinputs input { position: relative; text-align: right; -moz-opacity:0 ; filter:alpha(opacity: 0); opacity: 0; z-index: 2; } And JS: $('.fakefile').click(function() { $(this).parent().children('input').click(); }); This works fine in Chrome and Firefox.
In IE8, the following occurs: everything works fine, but when submitting the form file input is cleared, the form is not sent and the cursor is placed on a hidden file input, how to make it work in IE?

以上就是How to imitate click on file input?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准