Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8996385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:44:52+00:00 2026-06-15T23:44:52+00:00

hello I searched on the web but I couldn’t find the answer so I

  • 0

hello I searched on the web but I couldn’t find the answer so I need your precious help. There is my code:

    for(var i=0; i<10;i++){         
        LatLon=new google.maps.LatLng(39.633336, 22.386423);
        Marker= new google.maps.Marker({position:LatLon,map:MyMap,draggable: true,title:'Mytitle'+i});
        MarkersArray[] = Marker; //keep markers in array because i want to delete them later!!!
        google.maps.event.addListener(Marker,"dragend",function(event){
            var markerNewPosition = this.getPosition();
            alert("old position: **here i want to show the old position** \nnew position: "+markerNewPosition);
        });
    }

until now, when i drag the marker I alert the latitude and longitude of the new position of it. But i want something more! I want to alert the latitude and longitude of the old position. With other words I want in the dragend handler to get the coords of the previous place that marker was and the coords of the new place that marker goes. Dose anybody know a way how to do it? any idea will be appreciate. Thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:44:53+00:00Added an answer on June 15, 2026 at 11:44 pm

    You’ll need to grab that with a dragstart event listener. You could store that like so:

    var GLOBAL = {};
    
    ...
    
    google.maps.event.addListener(Marker,"dragstart",function(event){
        var markerOldPosition = this.getPosition();
        GLOBAL.startDragPosition = markerOldPosition;
    
    });
    google.maps.event.addListener(Marker,"dragend",function(event){
        var markerNewPosition = this.getPosition();
        alert("old position: " + GLOBAL.startDragPosition + " \nnew position: "+markerNewPosition);
        delete GLOBAL.startDragPosition;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I searched for an answer to this question but didn't find any here.
Ok, I've searched quite a bit, but seem unable to find an answer or
I have searched this web looking for an answer, but it seems that this
I've searched the web but i'm not getting it This is my flex code:
Hello i've read the Solr wiki and searched here but didn't find a solution
I searched this topic but there wasn't anything useful for me. CODE: public function
I searched for a solution but could not find an answer for my specific
Hello I searched a bit here and didnt find anything for what i need...
I have searched a lot of threads but i can't find any answer that
I've searched here a bit but could not find an answer to my issue.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.