title: How do I get the latlng after the dragend event in leaflet?
body: <p>I'm trying to update the lat/lng value of a marker after it is moved.  The example provided uses a popup window to display the lat/lng.</p>
  
  <p>I have a "dragend" event listener for the marker, but when I alert the value of e.latlng it returns undefined.</p>
  
  <p>javascript:</p>
  
  <pre><code>function markerDrag(e){
      alert("You dragged to: " + e.latlng);
  }
  
  function initialize() {
      // Initialize the map
      var map = L.map('map').setView([38.487, -75.641], 8);
      L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
          attribution: 'Map data &amp;copy; &lt;a href="http://openstreetmap.org"&gt;OpenStreetMap&lt;/a&gt; contributors, &lt;a href="http://creativecommons.org/licenses/by-sa/2.0/"&gt;CC-BY-SA&lt;/a&gt;',
          maxZoom: 18
      }).addTo(map);
  
      // Event Handlers
      map.on('click', function(e){
          var marker = new L.Marker(e.latlng, {draggable:true});
          marker.bindPopup("&lt;strong&gt;"+e.latlng+"&lt;/strong&gt;").addTo(map);
  
          marker.on('dragend', markerDrag);
      });
  }
  
  
  $(document).ready(initialize());
  </code></pre>
  
  <p><a href="http://jsfiddle.net/rhewitt/Msrpq/4/" rel="noreferrer">http://jsfiddle.net/rhewitt/Msrpq/4/</a></p>