-
Notifications
You must be signed in to change notification settings - Fork 264
/
Copy pathnext-adjacent-selector.xml
37 lines (37 loc) · 1.35 KB
/
next-adjacent-selector.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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 for="name">Name:</label>
<input name="name" id="name">
<fieldset>
<label for="newsletter">Newsletter:</label>
<input name="newsletter" id="newsletter">
</fieldset>
</form>
<input name="none">
]]></html>
</example>
<category slug="selectors/hierarchy-selectors"/>
<category slug="version/1.0"/>
</entry>