【问题标题】:Google maps autocomplete not working谷歌地图自动完成功能不起作用
【发布时间】:2012-12-11 05:43:52
【问题描述】:

我想获得谷歌地图的自动完成行为,但我没有得到它显示这个的确切原因

*Uncaught TypeError: Cannot read property 'Autocomplete' of undefined *

我在哪里使用这个

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

我有一个 id 为 'geoFenceAddress' 的元素,实际上警报正在显示此 [Object HTMLInputElement]

我不明白我的不足之处,请指教............

:(

【问题讨论】:

    标签: javascript html google-maps-api-3


    【解决方案1】:

    您需要在加载 API 时添加地点库。

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

    【讨论】:

    • 您还需要 API 密钥,因为不再支持旧方式。
    猜你喜欢
    • 2019-04-29
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 2022-11-04
    • 1970-01-01
    • 2013-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多