
Jennifer H. answered 04/04/20
Professional web developer
If var x contains the result of some jQuery selector, x.parent() gives you the HTML elements that contain each element in x, while x.parents() gives you all of the "ancestors" (the parents, the parents of those parents, the parents of those "grandparents", etc.) all the way up to the top-level html element. You can also filter parents() -- for example, x.parents('div') gives you all of the ancestor div elements, excluding other types of HTML elements from the list.