How to add draggable markers to a Google Map using jQuery -
i'm playing google maps , need directions :-)
i'd map draggable marker. if user drags marker formfields need updated coordinates of marker.
is there jquery-plugin can using v3 of google maps api?
you dont need jquery, won't make easier.
first create map , add draggable marker.
var mylatlng = new google.maps.latlng(-25.363882,131.044922); var marker = new google.maps.marker({ position: mylatlng, map: map, // handle of map draggable:true });
then need add event listener map listens marker drag event , updates textboxes.
google.maps.event.addlistener( marker, 'drag', function() { document.getelementbyid('lat').value = marker.position.lat(); document.getelementbyid('lng').value = marker.position.lng(); } );
Comments
Post a Comment