-1
我試圖在拖拽標記後在此處更新標記位置(經緯度和長度)DEMO。正如你所看到的,我能夠獲得標記的位置(lat long),但是當我更換標記時,捕獲的值不會更新!更新可拖拽標記位置值
var map;
$(document).ready(function() {
var latlng = new google.maps.LatLng(11.038003,125.736294);
var myOptions = {
zoom: 12,
center: latlng,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var cnt = 0;
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
google.maps.event.addListener(map, 'click', function (event) {
marker = new google.maps.Marker({
position: event.latLng,
map: map,
draggable: true,
title: "Camp Num: " + ++cnt
});
$('#myTable tbody:eq(1)').append('<tr class="child"><td>'+ marker.title +'</td><td>'+ marker.position.lat()+'</td><td>'+ marker.position.lng()+'</td></tr>');
});
});
能否請你讓我知道我怎麼可以更新他們
當你拖動標記你的意思,你要顯示新的價值? – KrishnaDhungana