I\'m trying to implement Google Places API, so here is my code:
I was able to solve my problem with the following code:
$(document).ready(function() {
var el = $('#street').attr("placeholder", "")
, autocomplete = new google.maps.places.Autocomplete( ( el.get(0) ), { types: ['geocode'] } );
el.bind("blur", function() {
el.css("color", "#fff"); // this will prevent text flashing
})
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
el.val(place.name);
// this will override default Google suggestion
setTimeout(function() {
el.val(place.name);
el.css("color", "");
}, 0)
});
})