parents
parents([selector]) ⇒ collection
Get all ancestors of each element in the collection. If CSS selector is given, filter results to include only ones matching the selector.
To get only immediate parents, use parent. To only get the first ancestor that matches the selector, use closest.
$('h1').parents() //=> [<div#container>, <body>, <html>]