Topic:
How to add Google Maps Autocomplete search box?
Solution:
Below are the steps and code.
Include google library.
1 | <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script> |
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