title: Issue with triggering Google Maps on button click
body: <p>I have written code which displays the map when the place changes in an autocomplete input box. But I'm having trouble shifting the event from</p>
  
  <pre><code>google.maps.event.addListener(autocomplete, 'place_changed', function() {}
  </code></pre>
  
  <p>to a button click. I mean, can we use <code>addListener</code> with a button click.</p>
  
  <p>Here is the HTML part:</p>
  
  <pre><code>&lt;body onload="initialize()"&gt;
      &lt;input id="searchTextField" type="text" size="50"&gt;
      &lt;input type="button" id="Go" value="Go"/&gt;
      &lt;div id="map_canvas"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And here is the Javascript code:</p>
  
  <pre><code>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);
    var go = document.getElementById('Go');
    var infowindow = new google.maps.InfoWindow();
    var marker = new google.maps.Marker({
      map: map
    });
    google.maps.event.addListener(autocomplete, 'place_changed', function() {
      infowindow.close();
      var place = autocomplete.getPlace();
      if (place.geometry.viewport) {
        map.fitBounds(place.geometry.viewport);
      } else {
        map.setCenter(place.geometry.location);
        map.setZoom(15);
      }
    var image = new google.maps.MarkerImage(
      place.icon,
      new google.maps.Size(71, 71),
      new google.maps.Point(0, 0),
      new google.maps.Point(17, 34),
      new google.maps.Size(35, 35));
    marker.setIcon(image);
    marker.setPosition(place.geometry.location);
    var address = '';
    if (place.address_components) {
      address = [(place.address_components[0] &amp;&amp;
        place.address_components[0].short_name || ''),
      (place.address_components[1] &amp;&amp;
        place.address_components[1].short_name || ''),
      (place.address_components[2] &amp;&amp;
        place.address_components[2].short_name || '')
      ].join(' ');
    }
    infowindow.setContent('&lt;div&gt;&lt;strong&gt;' + place.name + '&lt;/strong&gt;&lt;br&gt;' + address);
    infowindow.open(map, marker);
  });
  }
  </code></pre>