I have a map and a event to create a marker when user clicks on the map, but I wish that only one marke could be created at time. After user clicks on the map and create a marker, if he makes it again, the previous marker should disappear and only the new one will be avaiable.
Here it's the code that I have on my preparation:
Hi,
So to have only one marker, you can follow 2 approaches :
1. Either remove first marker or all other markers and add new one.
2. Update the position of first marker.
So above logic is correct. You just need to check if already a marker is there or not. If there, then update it.
regards
Hi, you can try this way: Place the eventListener inside the map initialize function & introduce a counter variable and you can use it inside addListing variable.