jQuery .parents() method allows us to search through the ancestors of these elements in the DOM tree and construct a new jQuery object from the matching elements ordered from immediate parent on up.
a. If the filter parameter is empty, this function will select all ancestors of a set of elements.
b. Parents is similar to closest(), in that they both traverse up the DOM tree but difference is closest() returns the first ancestor that matches the passed exp ression up to DOM tree
but parents returns all ancestors that matches the passed exp ression for DOM tree.
//With filter parameter
//Without filter parameter