title: Google maps event listener dragend
body: <p>I am adding an event listener to my marker, the function for the marker is:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function setupMarkerWaypoint() {
    console.log('setting waypoint marker');
    waypointMarker = new google.maps.Marker({
      position: default_latlng,
      map: mapBooking,
      icon: "http://maps.google.com/mapfiles/ms/micons/blue.png"
    });
  
    waypointMarker.setVisible(true);
  
    function geocodePosition(pos) {
      geocoder.geocode({
        'latLng': pos
      }, function(responses) {
        if (responses &amp;&amp; responses.length &gt; 0) {
          updateMarkerAddress(responses[0].formatted_address);
        } else {
          updateMarkerAddress('Cannot determine address at this location.');
        }
      });
    }
  
    function updateMarkerAddress(str) {
      document.getElementById('AddWaypoint').innerHTML = str;
    }
  
    // Update current position info.
  
    geocodePosition(latLng);
  
    // Add dragging event listeners.
  
    google.maps.event.addListener(waypointMarker, 'dragend', function() {
      updateMarkerStatus('Drag ended');
      geocodePosition(waypointMarker.getPosition());
    });
  
  }</code></pre>
  </div>
  </div>
  </p>
  <p>But I am unable to drag my marker on google maps. what necessary changes should I make?</p>