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();     } ); 

http://jsfiddle.net/xth5u/


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -