Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (33 sloc) 1.323 kb
<?xml version="1.0"?>
<entry type="selector" name="next adjacent" return="">
<title>Next Adjacent Selector ("prev + next")</title>
<sample>prev + next</sample>
<signature>
<added>1.0</added>
<argument name="prev" type="Selector">
<desc>Any valid selector.</desc>
</argument>
<argument name="next" type="Selector">
<desc>A selector to match the element that is next to the first selector.</desc>
</argument>
</signature>
<desc>Selects all next elements matching "next" that are immediately preceded by a sibling "prev".</desc>
<longdesc>
<p>One important point to consider with both the next adjacent sibling selector (<code>prev + next</code>) and the general sibling selector (<code>prev ~ siblings</code>) is that the elements on either side of the combinator must share the same parent.</p>
</longdesc>
<example>
<desc>Finds all inputs that are next to a label.</desc>
<code><![CDATA[$("label + input").css("color", "blue").val("Labeled!")]]></code>
<html><![CDATA[<form>
<label>Name:</label>
<input name="name" />
<fieldset>
<label>Newsletter:</label>
<input name="newsletter" />
</fieldset>
</form>
<input name="none" />]]></html>
</example>
<category slug="selectors/hierarchy-selectors"/>
<category slug="version/1.0"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.