.prevUntil()
In this chapter you will learn:
Syntax and Description
.prevUntil(selector)
gets all preceding siblings of each element up to, but not including.
selector
is a string containing a selector
expression to indicate where to stop matching previous sibling elements.
Its return value is the new jQuery object.
Consider a page with a simple definition list as follows:
<dl>/* ja v a 2s .c o m*/
<dt>term 1</dt>
<dd>definition 1-a</dd>
<dd>definition 1-b</dd>
<dd>definition 1-c</dd>
<dd>definition 1-d</dd>
<dt id="term-2">term 2</dt>
</dl>
$('#term-2').prevUntil('dt').css('background-color', 'red');
marks 1-a, 1-b, 1-c, and 1-d.
Next chapter...
What you will learn in the next chapter: