添加一个onblur
带有 iOS6 用户代理过滤器的过滤器,并在其中设置选定的索引。我确信有比这更好的方法,但它对我有用(这里有一些 jQuery):
<select id="test" onchange="alert(this.selectedIndex); this.selectedIndex = 0" onblur="FixSelecteOniOS6(this);">
<option>test1</option>
<option>test2</option>
<option>test3</option>
</select>
<script>
FixSelectOniOS6: function (ref){
alert(ref.selectedIndex)
var res = navigator.userAgent.match(/; CPU.*OS (\d_\d)/);
if (res) {
var strVer = res[res.length - 1];
strVer = strVer.replace("_", ".");
version = strVer * 1;
}
var i = 0,
iOS = false,
iDevice = ['iPad', 'iPhone', 'iPod'];
for (; i < iDevice.length; i++) {
if (navigator.platform === iDevice[i]) { iOS = true; break; }
}
if (navigator.platform.indexOf("iPad") != -1 && version == 6) {
$(ref).find("option").removeAttr("selected");
$(ref).find("option:first").attr("selected", "selected");
}
}
</script>