function initAutocomplete() {
var pickup = document.querySelector('[name="pickup-location"]');
var end = document.querySelector('[name="end-location"]');
if (pickup) new google.maps.places.Autocomplete(pickup);
if (end) new google.maps.places.Autocomplete(end);
}
document.addEventListener("DOMContentLoaded", initAutocomplete);