title: GoogleMaps apiv3 Events - addListener and addDomListener not working the same way?
body: <p>I'm having trouble trying to add a polygon to the map by clicking something outside of the map area, e.g. a text link on the same page as the map.</p>
  
  <p>I can add the polygon by clicking on the map via the addListener method but the same code with <code>addDomListener</code> doesn't work. Was wondering if anyone knows how to do this correctly?</p>
  
  <p>My code that is not working (i get the alert test so the listener is working but the polygon is not added to the map):</p>
  
  <pre><code>google.maps.event.addDomListener(document.getElementById('thediv'), 'click',function (event){
      drawPolygon();
      alert("test");
  });
  </code></pre>
  
  <p>The code that is working but not what I want (polygon is drawn and alert test is received):</p>
  
  <pre><code>google.maps.event.addListener(map, 'click',function (event){
      drawPolygon();
      alert("test");
  });
  </code></pre>
  
  <p>and the drawPolygon code which works:</p>
  
  <pre><code>function drawPolygon(){
  var bermudaTriangle;
  var triangleCoords = [
      new google.maps.LatLng(25.774252, -80.190262),
      new google.maps.LatLng(18.466465, -66.118292),
      new google.maps.LatLng(32.321384, -64.75737),
      new google.maps.LatLng(25.774252, -80.190262)
  ];
  
    bermudaTriangle = new google.maps.Polygon({
    paths: triangleCoords,
    strokeColor: "#FF0000",
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: "#FF0000",
    fillOpacity: 0.35
  });
  
  bermudaTriangle.setMap(map);
  }
  </code></pre>