Get Relative Cursor Coordinates Using jQuery

Today, We want to share with you Get Relative Cursor Coordinates Using jQuery.In this post we will show you jquery get mouse position without event, hear for jquery get mouse position relative to element we will give you demo and example for implement.In this post, we will learn about get mouse position javascript with an example.

Get Relative Cursor Coordinates Using jQuery

There are the Following The simple About Get Relative Cursor Coordinates Using jQuery Full Information With Example and source code.

As I will cover this Post with live Working example to develop Find Relative Cursor Coordinates Using jQuery, so the some major files and Directory structures for this example is following below.

  • index.html

How to Get Cursor Coordinates Using jQuery


This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.html.

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>How to Get Cursor Coordinates Using jQuery - Get Relative Cursor Coordinates</title>
<style type="text/css">
        background: #3d3d3d;
        border: 1px solid #000;
<script src=""></script>
<script type="text/javascript">
    $(document).ready(function() {
            var firsrX = event.pageX - $(this).offset().left;
            var secondY = event.pageY - $(this).offset().top;
            var results = "(" + firsrX + "," + secondY + ")";
<h2>jQuery Find Coordinates of Mouse Pointer</h2>
    <div id="card"></div>
    <p>Your Read Coordinates points of mouse pointer steps with respect area to the HTML Tags DIV card are: <strong class="mouse-livecrds"></strong></p>

jQuery Get Relative Mouse Position

simple Example of the Find Cursor Coordinates Using jQuery

$(function() {
$("#card-box").click(function(e) {
  var card = $(this).offset();
  var firsrX = (e.pageX - card.left);
  var secondY = (e.pageY -;
  alert("Your X coordinate: " + firsrX + "  Your Y coordinate: " + secondY);

Get Relative Cursor Coordinates – Output

Get Relative Cursor Coordinates Using jQuery
Get Relative Cursor Coordinates Using jQuery
Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Get Relative Cursor Coordinates Using jQuery.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1.   PHP Config Class to store configuration data
  2.   Angular 6 HTTP Get Method with Example
  3.   Laravel Passing Multiple Variables from Controller to View
  4.   Jquery Live Search Filter Example with Demo
  5.   Yoast Wordpress Seo Settings
  6.   hasproperty in javascript - How to Check If an Object Has a Property in JavaScript?
  8.   Send PHP variable to bootstrap modal popup via Ajax
  9.   Top 40 Laravel Interview Questions
  10.   Solution Fatal error: Call to undefined function base_url() in Codeigniter