Jquery 触发点击在 mac、Ipad 和 Safari 浏览器上不起作用iPhone [英] Jquery trigger click not working on safari browsers in mac, Ipad & Iphone

查看:51
本文介绍了Jquery 触发点击在 mac、Ipad 和 Safari 浏览器上不起作用iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在点击另一个按钮时触发 input type="file" 上的点击事件.

I am trying to trigger a click event on input type="file" on the click of an another button.

演示:http://jsfiddle.net/Y85g6/

它在所有浏览器中都能正常工作,除了 mac、Ipad 和 safari 浏览器.手机.

It's working fine in all browsers except on safari browsers in mac, Ipad & Iphone.

有什么技巧可以完成这个任务吗?

Is there any trick to accomplish this task?

推荐答案

找到了替代方案.

只需通过绝对定位将输入 type="file" 放在自定义按钮上,然后使用 jQuery fakeTo('fast',0) 将其隐藏.

Just position the input type="file" over the custom button by absolute positioning it and use jQuery fadeTo('fast',0) to hide it.

现在如果我们点击自定义按钮文件浏览器窗口就会出现.

Now if we click over the custom button file browser window appears.

它适用于所有桌面浏览器,但不适用于 iPhone &iPad 因为它们不允许上传任何文件.

Its working in all desktop browsers but not in iPhone & iPad as they don't allow to upload any file.

这篇关于Jquery 触发点击在 mac、Ipad 和 Safari 浏览器上不起作用iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆