What does the jQuery `.parent()` method return?
B
The immediate parent of each selected element
D
The first matched element
Analysis & Theory
`.parent()` returns the **immediate parent** of each selected element.
What is the difference between `.find()` and `.children()`?
A
`.find()` searches deeply, `.children()` only immediate children
C
`.children()` is faster but only works on divs
D
`.find()` only works with class selectors
Analysis & Theory
`.find()` searches **all descendants**, `.children()` only gets **immediate children**.
What does `.siblings()` do?
A
Selects all elements with the same class
B
Selects parent elements
C
Selects all siblings (same parent) excluding the element itself
D
Selects nested elements
Analysis & Theory
`siblings()` returns **all elements that share the same parent**, excluding the current one.
Which method is used to find the first ancestor that matches a selector?
Analysis & Theory
`.closest()` traverses **up the DOM tree** to find the **nearest ancestor** that matches the selector.
What does `$('li.active').next()` return?
C
The next sibling of the `<li class='active'>` element
Analysis & Theory
`next()` returns the **next sibling** element.
Which method is used to get the direct child elements of a selection?
Analysis & Theory
Use `.children()` to get **only immediate child elements**.
What does `.prevAll()` do?
A
Selects the previous sibling only
B
Selects all previous siblings
C
Selects all parent elements
D
Selects the last sibling
Analysis & Theory
`prevAll()` selects **all previous siblings** of the selected element.
Which method selects all ancestor elements up to but not including a selector?
Analysis & Theory
`.parentsUntil()` traverses up the DOM and **stops before the element matching the selector**.
What does `.eq(1)` return?
A
The first element in a selection
B
The element at index 1 (second element)
C
All elements except index 1
Analysis & Theory
`eq(n)` gets the **nth element** in the jQuery object (0-based index).
Which method would return all descendant `<span>` tags inside a `<div>`?
A
$('div').children('span')
D
$('span').parent('div')
Analysis & Theory
`find('span')` returns **all nested `<span>` elements** inside each `<div>`.