jQuery offsetParent() Method

jQuery HTML/CSS Methods : Set the background color of the closest positioned parent element of the <p> element

Definition and Usage

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

Tip: An element can be positioned with jQuery, or with the CSS position property (relative, absolute, or fixed).

Syntax

$(selector).offsetParent()