iOS选择onchange不会触发 [英] iOS select onchange not firing
本文介绍了iOS选择onchange不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< select onchange =window.location =(this.options [this.selectedIndex]。值)>
它适用于所有桌面浏览器,它也适用于我的WP7手机。它不适用于我的iPhone(iOS 5.0)。
解决方案
iOS往往不会触发更改
事件,当你改变他们的投入的价值。我在设备错误跟踪器中更深入地记录了这一点。
解决方法是绑定到 blur
事件。在上面的例子中,使用 onblur
,你就可以完成设置了。
< select onblur =window.location =(this.options [this.selectedIndex] .value)>
Does anyone know any workarounds for this? I'm trying to use a select element for navigation. It looks something like this;
<select onchange="window.location=(this.options[this.selectedIndex].value)">
It works on all desktop browsers and it also works on my WP7 phone. It doesn't work on my iPhone (iOS 5.0).
解决方案
iOS tends to not fire change
events when you change the value of their inputs. I've documented this in more depth at the Device-Bugs tracker.
The workaround is to bind to the blur
event instead. In the above example, use onblur
and you'll be all set.
<select onblur="window.location=(this.options[this.selectedIndex].value)">
这篇关于iOS选择onchange不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文