Find coordinates of an element

I want to find the coordinates of an image element and a rectangle when the user presses a button. If you could let me know how this may be done it would greatly be appreciated


You can’t directly access an arbitrary elements position from JS. What are you trying to achieve?