我的代码
javascript: var input = document.getElementById("Address_1"); var autocomplete = new google.maps.places.Autocomplete(input, { types:['geocode'] }); google.maps.event.addListener(autocomplete, 'place_changed', function () { var place = autocomplete.getPlace(); input.value = name; });
但文本框显示不正确。出什么事了?
你可以在谷歌API文档上试用,这里有演示链接
https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
干杯: D