Easy Tutorial
❮ Jquery Ajax Load Traversing First ❯

jQuery position() Method

jQuery HTML/CSS Methods

Example

Return the top and left position of a <p> element:

$("button").click(function(){
    x=$("p").position();
    alert("Top: " + x.top + " Left: " + x.left);
});

Definition and Usage

The position() method returns the position of the first matched element (relative to its parent).

This method returns an object with two properties (top and left positions in pixels).


Syntax


More Examples

Return the position of an element relative to its parent


jQuery HTML/CSS Methods

❮ Jquery Ajax Load Traversing First ❯