Actually, I have a map with a dragable marker. That works fine, but I can\'t update lat and lng of the dragged marker. I\'ve tried it with a few different Event listeners, b
I created a new marker on drag / click:
myListener = google.maps.event.addListener(map, 'click', function (event) {
placeMarker(event.latLng);
});
function placeMarker(location) {
if (marker) {
marker.setPosition(location);
} else {
marker = new google.maps.Marker({
position: location,
map: map,
draggable: true
});
google.maps.event.addListener(marker, "dragend", function (mEvent) {
saveLocation(mEvent.latLng);
});
}
saveLocation(marker.getPosition());
}
function saveLocation(pos) {
$("#hfLatitude").val(pos.lat());
$("#hfLogitude").val(pos.lng());
}