How to get the top position of an element?

javascript, jquery

Solution

If you want the position relative to the document then:

$("#myTable").offset().top;

but often you will want the position relative to the closest positioned parent:

$("#myTable").position().top;

Problem

Is it possible to get the top position of an element using javascript/jquery ? The element is a table, if that matters.

Original source