Say that I have an element inside a div (or any other containing element, or perhaps just in the body of the document). How do I get the (x,y) coordinates of that element, r
Use the below
document.getElementById("elementId").offsetTop; document.getElementById("elementId").offsetLeft;