To find the coordinates of the cursor in JavaScript, use event.clientX and event.clientY. You can try to run the following code to get cursor coordinates in JavaScript.
Example
<!DOCTYPE html> <html> <head> <script> function coordinatesFunc(event) { document.write("Coordinate(X) = " + event.clientX + "<br>Coordinate(Y) = " + event.clientY); } </script> </head> <body> <div onmousedown="coordinatesFunc(event)">Click me to get coordinates of cursor</p> </body> </html>