I set a marker on click on the map. I use MarkerWithLabel.
I use draggable marker.
If I drag a marker it works fine. But if I drag a label it works with click event on the map.
How can I use labels and can drag a label without click event?
In my example - when I drag a marker JS creates new marker.
google.maps.event.addListener(map, 'click', function(event) {
addMarker(event.latLng)
});
function addMarker(latLng) {
var marker = new MarkerWithLabel({
position: latLng,
map: map,
draggable: true,
labelContent: "example",
labelAnchor: new google.maps.Point(30, 0),
labelClass: "labels", // the CSS class for the label
labelStyle: {opacity: 0.75}
});
google.maps.event.addListener(marker, 'dragend', function(e) {
alert(2);
})
}