title: Google maps apiv3 'click' and 'dragend' single listener
body: <p>working on my code to retrieve lat,long by clicking and it works fine. wondering if its possible to combine 'click' and 'dragend' in a single event listener if not. Would appreciate whats a proper alternative. </p>
  
  <p>This is what I've been working on.</p>
  
  <pre><code>google.maps.event.addListener(map,'click', function(event) {
      document.getElementById("latbox").value = event.latLng.lat();
      document.getElementById("lngbox").value = event.latLng.lng();
      addMarker(event.latLng);
    });
  }
  
   function addMarker(location) {
  
  if (!marker) {
  
      marker = new google.maps.Marker({
      position: location,
      map: map,
      draggable:true,
      animation: google.maps.Animation.DROP
      });
  }
  // Otherwise, simply update its location on the map.
  else { marker.setPosition(location); }
   }
  </code></pre>
  
  <p>I tried doing this <code>google.maps.event.addListener(map,'click','dragend', function(event)</code> but to no avail. also if anyone has an idea to modify this <code>marker.setPosition(location);</code> to have <code>animation: google.maps.Animation.DROP</code> . . thanks in advance.</p>