How to Change Marker Position on Google Map using JavaScript

Google Maps JavaScript API provides various option to customize the Google Map functionality as per your needs. The marker position change on Google Map is one of them. Using JavaScript you can easily change the position of the marker on Google map without page refresh. Here we will provide short JavaScript code snippet to change Google Map marker position on click using JavaScript.

For better usability, the code has grouped in a JavaScript method. Call the changeMarkerPosition() function and pass the marker object in it. The setPosition() will change the marker position on google map based on the specified latitude and longitude.

function changeMarkerPosition(marker) {
    var latlng = new google.maps.LatLng(40.748774, -73.985763);

Related Articles

Comments 0