iPad IOS html表格选择不会打开 [英] iPad IOS html form select does not open on touch

查看:206
本文介绍了iPad IOS html表格选择不会打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个选择框,按以下方式创建:

 < select id =sizeonchange =位置= this.options [this.selectedIndex]。价值; NAME = 大小 > 
< option value =#catalog_860> 16< / option>
< option value =#catalog_861> 17< / option>
< option value =#catalog_862> 18< / option>
< option selected =selectedvalue =#catalog_863> 19< / option>
< / select>

在桌面Safari和其他浏览器上,它可以像预期的那样工作。



在移动Safari(iPad)上,它不会响应触摸。当我连接一个标签时,触摸标签会导致明显的选择(向下箭头按钮变成蓝色),但它不会显示选项。

I我现在打了两个小时。我错过了什么?

解决方案

我碰到同样的事情。
如果你打电话给你的javascript,检查你的javascript在哪里

  e.preventDefault(); 

在'touchstart'事件中。我设法避免这种情况。



pre $ function touchStart(e){
if(e.target.tagName!=' SELECT'){
e.preventDefault();
}
...
}


I have a select box, created in the following way:

<select id="size" onchange="location=this.options[this.selectedIndex].value;" name="size">
    <option value="#catalog_860">16</option>
    <option value="#catalog_861">17</option>
    <option value="#catalog_862">18</option>
    <option selected="selected" value="#catalog_863">19</option>
</select>

On Desktop Safari and other browsers it works like expected.

On Mobile Safari (iPad) it does not respond to touching. When I connect a label with it, touching the label results in visibly selecting the select (the down arrow button turns blue), but it does not show the options.

I am fighting it for two hours now. What am I missing?

解决方案

I bumped into the same thing as well. Check any where in your javascript if you call

e.preventDefault();

on the 'touchstart' event. I manage to avoid this by

function touchStart(e) {
    if (e.target.tagName != 'SELECT') {
        e.preventDefault();
    }
    ...
}

这篇关于iPad IOS html表格选择不会打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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