Google Map- How to add Google Maps Autocomplete search box?

Topic:

How to add Google Maps Autocomplete search box?

Solution:

Below are the steps and code.

Include google library.

HTML

1
<input id="searchTextField" type="text" size="50">

SCRIPT

1
2
3
4
5
6
7
function initialize() {
 
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input);
}
 
google.maps.event.addDomListener(window, 'load', initialize);

No comments:

Post a Comment