Jquery触发器点击不适用于mac,Ipad和amp;中的safari浏览器苹果手机 [英] Jquery trigger click not working on safari browsers in mac, Ipad & Iphone

查看:134
本文介绍了Jquery触发器点击不适用于mac,Ipad和amp;中的safari浏览器苹果手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在点击另一个按钮时触发输入类型=文件上的点击事件。

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

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

它在所有浏览器中都运行良好,除了在Safari浏览器中mac,Ipad& Iphone。

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 fadeTo('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和amp;中的safari浏览器苹果手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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