jQuery offsetParent() method
Example
Settings
the background color of the nearest positioned parent element of the.
$("button").click(function(){
$("p").offsetParent().css("background-color","red");
});
Try it »
Definition and Usage
The offsetParent() method returns the first positioned parent element.
**Tip:** An element can be positioned via the position property in jQuery or CSS (relative, absolute, or fixed).
Syntax
$(
selector
).offsetParent()
jQuery Traversal Methods