Last active
August 29, 2015 14:04
-
-
Save anhnt/c0e6625fb153cbb62793 to your computer and use it in GitHub Desktop.
google place autocomplete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script> | |
<script> | |
window.onload = function(){ | |
var locationField = document.getElementById('locationField'); | |
var input = document.createElement('input'); | |
input.setAttribute('id','autocomplete'); | |
input.setAttribute('type','text'); | |
locationField.appendChild(input); | |
var autocomplete = new google.maps.places.Autocomplete( | |
/** @type {HTMLInputElement} */(document.getElementById('autocomplete')), | |
{ types: ['geocode'] }); | |
google.maps.event.addListener(autocomplete, 'place_changed', function() { | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<div id="locationField"> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment