jQuery offsetParent()Method
Example
Set the background color of the nearest positioned ancestor of the <p> element:
$("button").click(function(){
$("p").offsetParent().css("background-color","red");
});
Try it Yourself »
Definition and Usage
The offsetParent() method returns the first positioned ancestor element.
Tip:Elements are positioned via the position property (relative, absolute, or fixed) using jQuery or CSS.
Syntax
$(selector).offsetParent()
Other Extensions
jQuery HTML/CSS Methods