我正在使用Google Maps Js API,当我搜索一个地方时,我的输入搜索栏工作正常。当我通过 iPhone 设备使用它时,它也工作正常,但是当我通过Android 设备使用它时,键盘会立即出现和消失。我已经找到了一些关于当我按下搜索栏时 android 键盘失去焦点的解决方案,但我不明白我应该如何或在哪里实施该解决方案。我有以下部分代码:
这是我的输入和 onclick 事件以及我的搜索栏:
<div class="col-sm-12" style="padding-right: 0px; margin-bottom: 10px;">
<span>Closest points</span>
<input id="locationTextField" type="text" size="40" float: left;">
<button class="btn pointsok" onclick='gotocustomlocation()' style="float: left; margin-left: 2px; width: 33px; padding-left: 6px; padding-right: 6px;">OK</button>
</div>
Run Code Online (Sandbox Code Playgroud)
也许上面的东西autocomplete.getPlace可以解决问题?
<script>
function gotocustomlocation() {
var place = autocomplete.getPlace();
var lat = place.geometry.location.lat();
var lng = place.geometry.location.lng();
console.log(lat);
console.log(lng);
jQuery.ajax({
type: 'GET',
url: "<?php echo JURI::base() . "index.php?option=com_ajax&module=points&format=json&method=getClosestAreas&lat=";?>" + lat + …Run Code Online (Sandbox Code Playgroud)