i am want to change the marker position on the click event to where the user clicked on the map, but my script don't seem to work.
this is the error i get on the console.
InvalidValueError: setPosition: not a LatLng or LatLngLiteral: in property lat: not a number
this is my script:
<script>
let map;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: -34.397, lng: 150.644 },
zoom: 8,
});
const uluru = { lat: -34.397, lng: 150.644 };
let marker = new google.maps.Marker({
position: uluru,
map: map,
draggable: true
});
google.maps.event.addListener(map,'click',
function (event){
moveMarker({position:event.latLng});
}
)
function moveMarker(props){
marker.setPosition(props)
}
}
</script>