I am trying to write a web application for my final year project at uni, and one of the first problems i need to tackle is getting an auto complete text box for local addres
var input = document.getElementById('inputSearch');
var cityBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(12.864162, 77.438610),
new google.maps.LatLng(13.139807, 77.711895));
var options = {
bounds: cityBounds,
strictBounds: true,
componentRestrictions: {country: 'in'}
};
var inputBox = new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(inputBox, 'place_changed', function() {
var place = inputBox.getPlace();
console.log(place.geometry.location.lat() +', '+ place.geometry.location.lng());
});
This works great for me!