Get a set of parents filtered by selector of each element in the current set of match elements.
selector
$('.orange').parents().length;//=> 2$('.orange').parents('#fruits').length;//=> 1
The parents.
https://api.jquery.com/parents/
Optional
If specified filter for parents.
Get a set of parents filtered by
selector
of each element in the current set of match elements.Example
Returns
The parents.
See
https://api.jquery.com/parents/