iOS 8第三方键盘不注册javascript/jQuery keyup,keypress,keydown等

ada*_*on5 23 javascript keyboard jquery ios8

当使用像Swiftkey这样的第三方键盘时,像keypress这样的javascript事件不会注册.例如,Google地图自动填充功能无法使用https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete

看起来像是一个iOS错误,但有关如何解决这个问题的任何想法?

ada*_*on5 1

我找到了一个使用 setInterval 的解决方案以及这里的回答方法Trigger Google Places Autocomplete

setInterval(function() {
if ($('input#mapSearch').is(':focus')) {
google.maps.event.trigger(document.getElementById('mapSearch'), 'focus', {});
}
}, 500);
Run Code Online (Sandbox Code Playgroud)