EDITABLE CODE:
LiveDemo:jQuery - Select Ancestors using parentsUntil()
Note:If no matches are found , then all the ancestors are selected.