Matías Fidemraizer
Matías Fidemraizer

Reputation: 64923

Event when marker location changes in Google Maps JavaScript API

I can't figure out how can I handle Google Maps marker changes.

Ideally, I want to get marker location changes in real-time.

Finally, I've checked the docs and I didn't find an specific event to cover this case.

Upvotes: 0

Views: 1615

Answers (2)

Fabian
Fabian

Reputation: 1

as found in https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.position_changed you can use the position_changed event on the marker.

marker.addListener("position_changed", e => {
   // Do stuff here
});

Upvotes: 0

Matías Fidemraizer
Matías Fidemraizer

Reputation: 64923

This was an easy one:

marker.addListener("dragend", e => {
   // Do stuff here
});

Upvotes: 3

Related Questions