position() method in jQuery

position() in jQuery

This method is used to Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.

This method returns an object containing the properties of top and left.




Try Yourself

Difference between offset() and position() in jQuery

The difference between offset and position is offset, it returns position of an element in the document, while position returns the position of an element within the parent element.

Example -

Try Yourself