本文介绍了移动Safari多选错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在手机Safari浏览器中使用多个选择字段(如果您在iOS 9上使用多选字段) - 像这样:
$ b

          选项值=0>全部< / option><选项值=1>测试1< / option><选项值=2>测试2< / option>< 3>测试3< / option>< option value =4>测试4< / option>< / select>  



在实际选项之前添加一个禁用和隐藏的optgroup。


If found a really annoying bug on the current (iOS 9.2) mobile safari (first appearing since iOS 7!)

If you using multi select fields on mobile safari - like this:

<select multiple>
    <option value="test1">Test 1</option>
    <option value="test2">Test 2</option>
    <option value="test3">Test 3</option>
</select>

You will have problems with automatically selection!

iOS is automatically selecting the first option after you opened the select (without any user interaction) - but it will not show it to you with the blue select "check".

So if you now select the second option, the select will tell you that two options are selected (but only highlighting one as selected)...

If you now close and open the select again, iOS will automatically deselect the first value - if you repeat, it will be selected again without any user interaction.

Thats a really annoying system bug, which is breaking the user experience!

解决方案

Solution for safari multi select bug and Empty and Disabled option tick related issue:

<select multiple>
<optgroup disabled hidden></optgroup>
<option value="0">All</option>
<option value="1">Test 1</option>
<option value="2">Test 2</option>
<option value="3">Test 3</option>
<option value="4">Test 4</option>
</select>

Add a disabled and hidden optgroup before the real options.

这篇关于移动Safari多选错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 08:59