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 6822775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:42:13+00:00 2026-05-26T21:42:13+00:00

There are, as of now, 3,898 posts in StackOverflow regarding mouse click coordinates. They

  • 0

There are, as of now, 3,898 posts in StackOverflow regarding mouse click coordinates. They all cover everything on how to find the coordinates for the mouse …. in relation to an element.

Has anyone been able to implement a solution where, at any point of your processing, you can recall the coordinates of the very last mouse click?

I have tried everything and every solution for the last 8 hours or so but cannot come accross anything that can recall the last mouse click coordinates.

Apparently, you have to catch it right where you are processing $(‘…’).click(function(e){…});

How about if I sent the processing somewhere and, within that processing (a few nanoseconds later) I want to find out the coordinates of the last mouse click? How can I retrieve it outside an specific function?

EDIT:

Based on sdleihssirhc’s suggestion, I was able to implement a solution that is working for me:

On the main page I have created two divs (to avoid dealing with arrays and global variables):

<div id='mouseX' style='display:none; ' ></div>
<div id='mouseY' style='display:none; ' ></div>

On the main page within the script tags:

$('#wrapper').click(function(e) {
    var offset = $(this).offset();
    $('#mouseX').text(e.clientX - offset.left);
    $('#mouseY').text(e.clientY - offset.top);
});

Whenever needed, I can just:

var clickX = $('#mouseX').text();
var clickY = $('#mouseY').text();

Thank you!

  • 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-05-26T21:42:14+00:00Added an answer on May 26, 2026 at 9:42 pm

    You can set up a global array, for keeping track of coordinates (maybe in an object, whatever). Then you can add an event listener to the document, listening for click. Then it’s just a matter of logging the position.

    Whenever you want to refer to the position during the last click, just refer to the appropriate element of your global array. (If your logging function unshifted instead of pushing, you could always just look at yourArray[0].)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just checked the developers' site homepage to find that there is now a
There are lots of Fluent implementations out there now that work with Lambdas to
There are now so many ways to write windows apps, win32, MFC, ATL, .NET,
Now there is a subject that could be taken many ways. Hopefully I will
EDIT: There's now a doc page on this so this question is irrelevant, also
I appreciate that there are now many mechanisms in dotnet to deal with XML
Or the concepts/best practices used there are now deprecated? I'm just starting to use
From the .net 4.0 previews I have read until now there has been lots
I just upgrade to Ubuntu Karmic 9.10 and there is now emphaty. The problem
I have data like below AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE Now there is a

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.