title: Google Places Autocomplete API Country Restriction
body: <p>First time poster here. Having some trouble getting the country restriction working on a search field. My code is currently:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?libraries=places&amp;sensor=false"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function initialize() {
      var mapOptions = {
          //center: new google.maps.LatLng(-33.8688, 151.2195),
          zoom: 13,
          mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById('map_canvas'),
      mapOptions);
  
      var input = document.getElementById('searchTextField');
      var autocomplete = new google.maps.places.Autocomplete(input);
  
      autocomplete.bindTo('bounds', map);
      // Autocomplete.
      function setupClickListener(id, types) {
          var radioButton = document.getElementById(id);
          google.maps.event.addDomListener(radioButton, 'click', function() {
              autocomplete.setTypes(types);               
          });
      }    
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  &lt;/script&gt;
  </code></pre>
  
  <p>What would I need to to do to get this to limit by country? I've tried adding:</p>
  
  <pre class="lang-js prettyprint-override"><code>   componentRestrictions: {country: 'us'}
  </code></pre>
  
  <p>And this stops the autocomplete working altogether, no obvious syntax errors.</p>
  
  <p>Forgive me if it seems lazy but I'm relatively new to programming so need all the help I can get! I'm trying to modify an existing instance of the API here so didn't code it to start with which is undoubtedly adding to my confusion.</p>
  
  <p>Thank you.</p>