Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
$('.pear').parent().attr('id');//=> fruits
The parents.
https://api.jquery.com/parent/
Optional
If specified filter for parent.
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
Example
Returns
The parents.
See
https://api.jquery.com/parent/