<input type="text" name="pickup_pick_address" placeholder="Start typing your address" class="form-control" id="pickup_pick_address" />
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=your_api_here&libraries=places"></script>
<script>
google.maps.event.addDomListener(window, 'load', initialize);
function initialize() {
var input = document.getElementById('pickup_pick_address');
var autocomplete = new google.maps.places.Autocomplete(input);
//for specific location show
/* autocomplete.setComponentRestrictions({'country': ['CA']}); */
autocomplete.addListener('place_changed', function () {
var place = autocomplete.getPlace();
$('#lat').val(place.geometry['location'].lat());
$('#long').val(place.geometry['location'].lng());
});
}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=your_api_here&libraries=places"></script>
<script>
google.maps.event.addDomListener(window, 'load', initialize);
function initialize() {
var input = document.getElementById('pickup_pick_address');
var autocomplete = new google.maps.places.Autocomplete(input);
//for specific location show
/* autocomplete.setComponentRestrictions({'country': ['CA']}); */
autocomplete.addListener('place_changed', function () {
var place = autocomplete.getPlace();
$('#lat').val(place.geometry['location'].lat());
$('#long').val(place.geometry['location'].lng());
});
}
</script>
No comments:
Post a Comment