javascript - Resend autocomplete init function to google maps api -
i have function called "autocompleteaddress" is initializing auto complete on input. function looks per do
function initautocomplete() { // create autocomplete object, restricting search geographical // location types. autocomplete = new google.maps.places.autocomplete( /** @type {!htmlinputelement} */(document.getelementbyid('autocomplete')), {types: ['geocode']}); // when user selects address dropdown, populate address // fields in form. autocomplete.addlistener('place_changed', fillinaddress); }
now @ bottom have normal script send function name google api, following
<script src="https://maps.googleapis.com/maps/api/js?key=your_api_key&signed_in=true&libraries=places&callback=initautocomplete" async defer></script>
now doing modifications ui, , after modifications auto complete doesn't work more, reason being specific input destroyed , new 1 created.
now question is there way can tell google have updated input one. resending function sort of speak.
okay have figured out need call constructor again so
google_autocomplete.autocomplete.constructor(document.getelementbyid('element'))
Comments
Post a Comment