JQuery - How to Get X and Y Position of an Element on Click Event?
If you need to see example of how to get x y position of an element with jquery. you will learn jquery get x y position mouse click. you can understand a concept of how to get x and y coordinates of an element in jquery. We will use jquery get x y coordinates of mouse click.
Let's see image example with preview:
<title>jquery example - ItSolutionStuff.com</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" crossorigin="anonymous"></script>
<img id='image' src='https://dummyimage.com/600x400/000/fff' />
var offset = $(this).offset();
var x = e.clientX - offset.left;
var y = e.clientY - offset.top;
I hope it can help you...
We are Recommending you
- JQuery Moment Subtract Minutes to Datetime Example
- Jquery Input Mask Phone Number Validation Example
- Jquery - How to Count Child Elements in Div?
- Codeigniter - add/remove multiple input fields dynamically with jquery
- How to call AngularJS controller function in Jquery?
- How to disable right click on div using context menu jquery?
- Check and Uncheck checkboxes using JQuery
- How can i print php variable in jquery?
- Select only one checkbox at a time using Jquery
- How to convert line breaks to br in jQuery ?