$(".element").parents();
will give all parents of .element
(including html
and body
)
DEMO
To find any specific parent, suppose container1
then
$('.element').parents('.container1')
DEMO
jQuery .parents() generally find all parents, but if you passed a selector then it will search for that.