簡體   English   中英

Google地圖自動填充無法正常工作

[英]Google maps autocomplete not working

我想獲得谷歌地圖的自動完成行為,但我沒有得到它顯示這一點的確切原因

* 未捕獲的TypeError:無法讀取未定義的屬性“自動完成”*

在哪里我用這個

  var addressValue = document.getElementById('geoFenceAddress');
  alert(addressValue);
  var autocomplete = new google.maps.places.Autocomplete(addressValue);
  autocomplete.bindTo('bounds', geoFenceAddress);

我有一個id為' geoFenceAddress '的元素, 實際上警報顯示了這個[Object HTMLInputElement]

我不明白我缺少的地方,請說清楚.........

:(

您需要在加載API時添加場所庫。

<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM