Maps API v3 Places Autocomplete

Simple Places API autocomplete field

HTML

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false&amp;libraries=places"></script>
  <div class="box">
    <input id="autocomplete" placeholder="Enter your address" type="text" />
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
  </div>

CSS

#autocomplete {
    width:300px;
    position: absolute;
}

.box {
  height: 250px;
  overflow: scroll;
  box-sizing: border-box;
  position: relative;
}

.pac-container {
  position: absolute;
}

JavaScript

function initialize() {
	 	var options = {componentRestrictions: {country: 'uk'}, types: ['geocode']}
    new google.maps.places.Autocomplete(
    (document.getElementById('autocomplete')), options);
}

initialize();