So far I can click on the map and then the Longitude and Latitude will be shown on the text field below the map, on the next click the marker will move to the new location and the new Longitude and Latitude will be shown on the text field. But I'm trying to make the shown Longitude and Altitude to be saved once the "SAVE" button is clicked, so the marker will be there and not move on the next click. Sorry for my horrible explanation skill guys, TLDR: How can i store the current longitude and latitude without it disappearing on the next click ? Here's my code to show the current longitude and latitude
function taruhMarker(petasaya, posisiTitik){
if( marker ){
marker.setPosition(posisiTitik);
}
else {
marker = new google.maps.Marker({
position: posisiTitik,
map: petasaya
});
}
document.getElementById("lat").value = posisiTitik.lat();
document.getElementById("lng").value = posisiTitik.lng();
document.getElementById("info").value = posisiTitik.info();
}
And here's the code i use for the text field and button
<tr>
<td><input type="text" id="lat" name="lat" value="" readonly> </td>
<td><input type="text" id="lng" name="lng" value="" readonly></td>
</tr>
<tr>
<td><h3> Info Marker </h3></td>
</tr>
</table>
<center><textarea rows="7" cols="50" ></textarea><br><br>
<center><input button type="button" id="button" value="SAVE"></input>
I live in Indonesia so most of the variables i use are in Indonesian languages