function initialize() { var options = { componentRestrictions: {country: "uk"} }; var input = document.getElementById('book1'); new google.maps.places.Autocomplete(input, options); var input2 = document.getElementById('book2'); new google.maps.places.Autocomplete(input2, options); } google.maps.event.addDomListener(window, 'load', initialize);