PHP Classes
elePHPant
Icontem

Marker on Click

Recommend this page to a friend!

      Map Builder  >  All threads  >  Marker on Click  >  (Un) Subscribe thread alerts  
Subject:Marker on Click
Summary:Marker on Click and save lat and lng
Messages:3
Author:Luis Arturo López Vergara
Date:2018-03-11 00:47:07
 

  1. Marker on Click   Reply   Report abuse  
Luis Arturo López Vergara - 2018-03-11 00:47:07
Hi. I´m using this incredible class, but at this moment I have a problem, is it possible to click in the map to make a marker but the lat and lng information appear in a input for each value.

Thank´s best regards.

  2. Re: Marker on Click   Reply   Report abuse  
Vagharshak Tozalakyan - 2018-03-11 14:18:13 - In reply to message 1 from Luis Arturo López Vergara
You can add a click event listener on map and get lat and lng coordinates on click:

function mbOnAfterInit(map) {
google.maps.event.addListener(map, "click", function(e) {
console.log(e.latLng.lat(), e.latLng.lng());
});
}

  3. Re: Marker on Click   Reply   Report abuse  
Luis Arturo López Vergara - 2018-03-11 19:28:14 - In reply to message 2 from Vagharshak Tozalakyan
Thanks Vagharshak I do it, in the other hand it's possible to reload the map with and event or function in your class to see new markers, thanks, hope this questions it´s to newby.