Skip to content

Instantly share code, notes, and snippets.

View icyz's full-sized avatar
🐱
Focusing

Andrea icyz

🐱
Focusing
View GitHub Profile
@stefanfoulis
stefanfoulis / gist:5352655
Created April 10, 2013 07:51
google places autocomplete widget limited to cities
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("maps", "3.x", {callback: initialize, other_params:'sensor=false&libraries=places'});
function initialize() {
var input = document.getElementById('id_location');
var autocomplete = new google.maps.places.Autocomplete(input, { types: ['(cities)'], region:'EU' });
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
if (!place.geometry) {