简体   繁体   English

Google地图自动填充无法正常工作

[英]Google maps autocomplete not working

I want to get the auto complete behaviour of the Google maps, but I am not getting the exact reason why it is showing this 我想获得谷歌地图的自动完成行为,但我没有得到它显示这一点的确切原因

* Uncaught TypeError: Cannot read property 'Autocomplete' of undefined * * 未捕获的TypeError:无法读取未定义的属性“自动完成”*

where as I used this 在哪里我用这个

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

I have an element with id ' geoFenceAddress ' and infact the alert is showing this [Object HTMLInputElement] . 我有一个id为' geoFenceAddress '的元素, 实际上警报显示了这个[Object HTMLInputElement]

I am not understanding where I am lacking , please shed some light......... 我不明白我缺少的地方,请说清楚.........

:( :(

您需要在加载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