Eff Stop
        
        Traversing Eq
        
        Jq Sel Empty
        
        Misc Deferred Rejectwith
        
        Misc Iswindow
        
        Traversing Parents
        
        Jq Sel Not
        
        Jquery Plugin Password Validation
        
        Event Namespace
        
        Jquery Events
        
        Prop Cssnumber
        
        Jq Event Timestamp
        
        Misc Parsehtml
        
        Misc Isemptyobject
        
        Ajax Serializearray
        
        Sel Input Text
        
        Event Preventindex
        
        Event Change
        
        Sel Firstoftype
        
        Eff Fadein
        
        Jq Sel Attribute
        
        Event Keypress
        
        Prop Jquery Fx Interval
        
        Sel Attribute Contains Value
        
        Jquery Chaining
        
        Event Contextmenu
        
        Misc Extend
        
        Event Proxy
        
        Jquery Ref Ajax
        
        Misc Deferred Then
        
        Misc Deferred Rejectwith
        
        Misc Callbacks Disable
        
        Sel Input Checked
        
        Html Unwrap
        
        Prop Context
        
        Misc Promise
        
        Event Mouseleave
        
        Jquery Selectors
        
        Event Unbind
        
        Misc Deferred Reject
        
        Sel Input Checkbox
        
        Jquery Install
        
        Html Csshooks
        
        Misc Type
        
        Jquery Css Classes
        
        Jquery Dom Add
        
        Traversing Prev
        
        Event Focusout
        
        Html Toggleclass
        
        Sel Contains
        
        Misc Isxmldoc
        
        Html Wrapall
        
        Traversing Closest
        
        Html Wrapinner
        
        Traversing Has
        
        Jquery Callback
        
        Html Attr
        
        Jquery Plugin Treeview
        
        Misc Deferred Always
        
        Traversing Prevuntil
        
        Misc Isarray
        
        Event Focusin
        
        Sel Hidden
        
        Jquery Ref Prop
        
        Sel Lastchild
        
        Sel Previous Next
        
        Event Mouseup
        
        Event Currenttarget
        
        Traversing Add
        
        Misc Unique
        
        Ajax Ajaxstart
        
        Sel Onlychild
        
        Traversing Parent
        
        Sel Multiple Classes
        
        Event Live
        
        Event Delegate
        
        Traversing Filter
        
        Misc Callbacks Fire
        
        Jquery Plugin Message
        
        Jquery Dom Get
        
        Jquery Traversing Ancestors
        
        Event Ispropagationstopped
        
        Jq Sel All
        
        Sel Input File
        
        Misc_Data
        
        Misc Callbacks Fired
        
        Html Append
        
        Sel Input Image
        
        Event On
        
        Ajax Get
        
        Jq Event Relatedtarget
        
        Jquery Stop
        
        Html Removeclass
        
        Sel Last
        
        Jquery Css
        
        Event Isdefaultprevented
        
        Jquery Animate
        
        Misc Pushstack
        
        Misc Globaleval
        
        Sel Lastoftype
        
        Sel Eq
        
        Event_Metakey
        
        Ajax Post
        
        Event One
        
        Event Focus
        
        Jq Sel Lang
        
        Sel Input Password
        
        Sel Nthlastchild
        
        Sel Input Reset
        
        Ajax Ajaxsend
        
        Misc Param
        
        Css Height
        
        Eff Fadetoggle
        
        Misc Now
        
        Jq Event Target
        
        Misc Map
        
        Html Outerheight
        
        Sel Attribute Equal Value
        
        Jq Sel Firstchild
        
        Event Load
        
        Sel Input Selected
        
        Eff Slidetoggle
        
        Misc Deferred Isresolved
        
        Misc Deferred Fail
        
        Sel Animated
        
        Event Submit
        
        Event Isimmediatepropagationstopped
        
        Misc Fn Extend
        
        Misc Callbacks Firewith
        
        Misc Merge
        
        Html Removeattr
        
        Traversing Find
        
        Ajax Ajaxstop
        
        Traversing Siblings
        
        Jquery Ref Effects
        
        Ajax Ajax
        
        Eff Animate
        
        Jq Sel Element
        
        Html Replaceall
        
        Prop Length
        
        Eff Fadeout
        
        Misc Callbacks Empty
        
        Sel Parent Descendant
        
        Misc Hasdata
        
        Event Mouseout
        
        Eff Toggle
        
        Event Off
        
        Sel Input Submit
        
        Eff Delay
        
        Misc_Each
        
        Sel Has
        
        Jquery Ref Html
        
        Jquery Plugin Prettydate
        
        Sel Input Disabled
        
        Jquery Tutorial
        
        Misc Isplainobject
        
        Traversing Children
        
        Eff Dequeue
        
        Misc Get
        
        Misc Trim
        
        Html Prependto
        
        Jq Sel Class
        
        Misc Jquery Readyexception
        
        Sel Attribute Notequal Value
        
        Event Ready
        
        Sel Multiple Elements
        
        Event Undelegate
        
        Sel Gt
        
        Traversing Parentsuntil
        
        Html Wrap
        
        Html Before
        
        Jquery Ajax Load
        
        Css Position
        
        Traversing First
        
        Traversing Each
        
        Misc Deferred Pipe
        
        Misc Deferred Promise
        
        Jquery Plugin Accordion
        
        Misc Deferred State
        
        Html Innerheight
        
        Event Mousedown
        
        Misc When
        
        Sel Nthchild
        
        Html Hasclass
        
        Html Clone
        
        Sel Input Radio
        
        Html Toggleclass
        
        Event Bind
        
        Jquery Dimensions
        
        Sel Nthlastoftype
        
        Event Scroll
        
        Jquery Plugin Validate
        
        Misc Deferred Notify
        
        Eff Queue
        
        Jquery Plugin Tooltip
        
        Html Innerwidth
        
        Ajax Ajaxcomplete
        
        Traversing Next
        
        Sel Nthoftype
        
        Misc Deferred Isrejected
        
        Misc Isnumeric
        
        Event Mouseover
        
        Misc Deferred Resolvewith
        
        Prop Jquery Fx Off
        
        Ajax Getscript
        
        Jquery Ref Traversing
        
        Html Prop
        
        Jquery Ajax Get Post
        
        Event Error
        
        Sel Parent
        
        Misc Deferred Resolvewith
        
        Sel Onlyoftype
        
        Event Select
        
        Css Scrolltop
        
        Html Detach
        
        Sel Lt
        
        Sel Attribute End Value
        
        Prop Jquery
        
        Ajax Ajaxsetup
        
        Event Keyup
        
        Sel Odd
        
        Css Offsetparent
        
        Sel Parent Child
        
        Event Pagey
        
        Prop Jquery Support
        
        Jquery Syntax
        
        Jquery Examples
        
        Jquery Plugin Autocomplete
        
        Misc Removedata
        
        Html Val
        
        Misc Index
        
        Jq Sel Root
        
        Sel Previous Siblings
        
        Misc Isfunction
        
        Traversing Slice
        
        Event Holdready
        
        Jq Sel Focus
        
        Sel Input
        
        Event Keydown
        
        Jquery Fade
        
        Eff Finish
        
        Sel Input Button
        
        Jquery Traversing Siblings
        
        Traversing Prevall
        
        Eff Clearqueue
        
        Sel Visible
        
        Traversing Nextall
        
        Misc Callbacks Remove
        
        Misc Callbacks Has
        
        Traversing Not
        
        Misc Parsexml
        
        Jq Sel Id
        
        Traversing Contents
        
        Html Appendto
        
        Event Trigger
        
        Event Mousemove
        
        Sel Attribute Beginning Value
        
        Ajax Ajaxsuccess
        
        Css Scrollleft
        
        Css Width
        
        Misc Callbacks Add
        
        Traversing Offsetparent
        
        Html Insertbefore
        
        Misc Data
        
        Jquery Ref Selectors
        
        Misc Jquery Speed
        
        Ajax Load
        
        Misc Callbacks Locked
        
        Sel Multipleattribute Equal Value
        
        Event Dblclick
        
        Misc Makearray
        
        Jq Event Type
        
        Css Css
        
        Eff Hide
        
        Jquery Intro
        
        Eff Fadeto
        
        Misc Deferred Resolve
        
        Jquery Slide
        
        Eff Show
        
        Html Escapeselector
        
        Event Stoppropagation
        
        Event Die
        
        Eff Slideup
        
        Event Stopimmediatepropagation
        
        Misc Grep
        
        Traversing Is
        
        Jquery Traversing
        
        Jquery Hide Show
        
        Misc Noop
        
        Html Remove
        
        Misc Deferred Done
        
        Misc Uniquesort
        
        Sel Header
        
        Event Unload
        
        Sel Even
        
        Eff Slidedown
        
        Html Replacewith
        
        Jquery Ajax Intro
        
        Misc Browser
        
        Misc Callbacks Lock
        
        Misc Inarray
        
        Traversing Parentsuntil
        
        Html Empty
        
        Jq Event Currenttarget
        
        Event Hover
        
        Jquery Dom Set
        
        Misc Jquery Htmlprefilter
        
        Html Insertafter
        
        Html Html
        
        Misc Deferred Notifywith
        
        Html Addclass
        
        Index
        
        Misc Callbacks Disabled
        
        Event Which
        
        Html After
        
        Sel Attribute Prefix Value
        
        Misc Size
        
        Jquery Cookie Plugin
        
        Ajax Getjson
        
        Html Removeprop
        
        Ajax Ajaxerror
        
        Sel Class
        
        Jquery Noconflict
        
        Jquery Ref Events
        
        Misc Each
        
        Html Escapeselector
        
        Event Resize
        
        Css Offset
        
        Jq Sel Target
        
        Html Outerwidth
        
        Event Blur
        
        Ajax Param
        
        Misc Noconflict
        
        Html Prepend
        
        Event Mouseenter
        
        Jquery Ref Misc
        
        Misc Deferred Progress
        
        Html Text
        
        Traversing Last
        
        Sel First
        
        Misc Jquery Sub
        
        Event Click
        
        Sel Attribute Contains String Value
        
        Event Toggle
        
        Jquery Traversing Descendants
        
        Ajax Serialize
        
        Event Triggerhandler
        
        Misc Parsejson
        
        Sel Input Enabled
        
        Misc Jquery Deferred
        
        Misc Callbacks
        
        Misc Contains
        
        Event Data
        
        Traversing Nextuntil
        
        Event Pagex
        
        Event Result
        
        Misc Toarray
        
        Jquery Traversing Filtering
        
        Jquery Dom Remove
        
        Event Delegatetarget
        
        Sel Firstchild
        
      
      jQuery parentsUntil() Method
Example
Returns all ancestor elements between a <span> and a <div>:
Result:
- li (direct parent)
Definition and Usage
The parentsUntil() method returns all ancestor elements between the selector and stop.
Ancestors are the parent, grandparent, great-grandparent, and so on.
DOM Tree: This method traverses the ancestors of the DOM elements upwards from the parent, all the way to the document root, until it reaches the specified element.
Note: If both parameters are empty, the method will return all ancestor elements (same as the parents() method).
Related Methods:
- parent() - Returns the direct parent of the selected element
- parents() - Returns all ancestor elements of the selected element
- closest() - Returns the first ancestor of the selected element
Syntax
| Parameter | Description | 
|---|---|
| stop | Optional. A selector expression, element, or jQuery object indicating where to stop matching ancestor elements. | 
| filter | Optional. A selector expression that narrows down the scope of the search for ancestor elements between the selector and stop. <br> <br> Note: To return multiple ancestor elements, separate each expression with a comma. | 
More Examples
Return Multiple Ancestor Elements
Filter Search Using DOM Elements and Selector Expressions