Geographic Information Systems Asked by Chivalry on February 27, 2021
This is my code:
map.on("click", function(e) {
var latlng = e.latlng;
document.getElementById("lat1").value = latlng.lat;
document.getElementById("lng1").value = latlng.lng;
console.log(latlng);
});
How can I show all polyline coordinates, displaying in console.log
, into text input?
You need to append to the contents of the input elements, not overwrite them, so your code becomes
map.on("click", function(e) {
var latlng = e.latlng;
document.getElementById("lat1").value += latlng.lat;
document.getElementById("lng1").value += latlng.lng;
console.log(latlng);
});
Note the +=
instead of =
in lines 2 and 3 of your function
Answered by til_b on February 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP