我的代码
html:
input type='text' name='Address_A' id='Address_1' placeholder='Nhập địa chỉ' autocomplete='off'
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; });
但文本框显示不正确。有什么问题?
答案 0 :(得分:0)
您可以试用Google API文档 这里的链接是演示
https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
干杯:D