javascript - Google maps autocomplete not working - Stack Overflow

I want to get the auto plete behaviour of the Google maps, but I am not getting the exact reason why it

I want to get the auto plete behaviour of the Google maps, but I am not getting the exact reason why it is showing this

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

where as I used this

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

I have an element with id 'geoFenceAddress' and infact the alert is showing this [Object HTMLInputElement].

I am not understanding where I am lacking , please shed some light.........

:(

I want to get the auto plete behaviour of the Google maps, but I am not getting the exact reason why it is showing this

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

where as I used this

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

I have an element with id 'geoFenceAddress' and infact the alert is showing this [Object HTMLInputElement].

I am not understanding where I am lacking , please shed some light.........

:(

Share asked Dec 11, 2012 at 5:43 Ankur VermaAnkur Verma 5,93316 gold badges61 silver badges95 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 6

You need to add the places library when you load the API.

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744920194a4601085.html

相关推荐

  • javascript - Google maps autocomplete not working - Stack Overflow

    I want to get the auto plete behaviour of the Google maps, but I am not getting the exact reason why it

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信