aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery How to Get Mouse Cursor Position

Nov 25, 2012

In this 
jQuery snippet I will explain how to get current mouse or cursor position in jQuery.

In previous posts I explained jQuery Allow only numbers in textbox, jQuery Accordion Menu Example,
jQuery lightbox slideshow, jQuery Create Rounded Corners Textbox and many articles relating to JQuery, Now I will explain how to get current position of mouse or cursor in JQuery.

To implement this functionality we need to write the code like as show below

<script type="text/javascript">
$(function() {
$(document).mousemove(function(e) {
$('#lbltxt').html("X Axis: "+e.pageX+"<br/>"+ "Y Axis: "+e.pageY);
If you want to see it in complete example write the following code in your aspx page

<html xmlns="">
<head runat="server">
<title>jQuery Get Mouse or Cursor Position</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(function() {
$(document).mousemove(function(e) {
$('#lbltxt').html("X Axis: "+e.pageX+"<br/>"+ "Y Axis: "+e.pageY);
<form id="form1" runat="server">
<label id="lbltxt" />
Live Demo

To check Live demo try to move your cursor and check x and y axis values below

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.