Easy Tutorial
❮ Misc Callbacks Add Html Insertbefore ❯

jQuery offsetParent() Method

jQuery Traversing Methods

Example

Set the background color of the nearest positioned parent element of a <p> element:


Definition and Usage

The offsetParent() method returns the first positioned parent element.

Tip: Elements can be positioned using jQuery or CSS position properties (relative, absolute, or fixed).


Syntax


jQuery Traversing Methods

❮ Misc Callbacks Add Html Insertbefore ❯