某些javascript函数无法在iOS设备上运行(iPhone,iPad) [英] some javascript functions don't work on iOS devices (iPhone, iPad)

查看:372
本文介绍了某些javascript函数无法在iOS设备上运行(iPhone,iPad)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望你能帮助我。我花了好几天试图解决这个问题后吓坏了。



我的JavaScript鼠标事件功能在iOS设备上不起作用。我红了这篇苹果文章我添加到我的html标签这个属性: onclick =void(0)但它只是不想工作。我可以在任何鼠标事件上触发警报消息,如下所示:

  document.getElementById(el)。addEventListener(mousedown ,function(){
alert(Bla-Bla);
)};

但是在同一个eventlistener中这样的东西没有被执行:

  document.getElementById(el)。classList.remove(bla-class); 

有人可能知道这个问题是否有解决方案?

解决方案

问题不在您的代码上,问题是IOS中的浏览器不能使用常规JavaScript,所以你可以尝试去设置> safaria>高级> JavaScript并启用它,就是这样,我希望这对你有帮助。



生活给你很好的代码


hope you can help me. I'm freaking out after spending several days trying to solve this problem.

My JavaScript mouse event functions don't work on iOS devices. I red this apple article and i added to my html tags this attribute: onclick="void(0)" but it just doesn't want to work. i can trigger an alert message on any mouse events like this:

document.getElementById("el").addEventListener("mousedown", function(){
alert("Bla-Bla");
)};

but stuff like this inside the same eventlistener is not being executed:

document.getElementById("el").classList.remove("bla-class");

does somebody maybe know if there is a solution for this problem?

解决方案

The problem could not be on your code, the thing is that regularlly JavaScript is not eneble for browsers in IOS, so you can try go to settings > safaria > advanced > JavaScript and enable it, that's it, i hope this help you.

That life gives you good code

这篇关于某些javascript函数无法在iOS设备上运行(iPhone,iPad)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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