用户自动完成google api时无法修改值

时间:2014-03-12 04:26:19

标签: javascript jquery

我的代码

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;
            });

但文本框显示不正确。有什么问题?

1 个答案:

答案 0 :(得分:0)

您可以试用Google API文档 这里的链接是演示

https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete

干杯:D