兄弟セレクタ
兄弟セレクタはチルダ(~)でつなげることで指定した要素以降に登場する兄弟要素(自身は含まない)のjQueryオブジェクトを返します。
次のようなHTMLがあったとして、
<ul>
<li id="list1">list1</li>
<li id="list2">list2</li>
<li id="list3">list3</li>
<li id="list4">list4</li>
</ul>
次のセレクタでは#list2以降のli要素(つまり#list3と#list4)を含んだjQueryオブジェクトを返します。
$("#list2 ~ li")
参考URL
Next Siblings Selector (“prev ~ siblings”) – jQuery API
登録日 : 2012年09月25日 最終更新日 : 2012年9月25日
同じカテゴリー(Selectors)のエントリー
- :disabled
- [attribute~=’value’]
- [attribute|=’value’]
- :animated
- :focus
- :target
- :lang()
- :root
- :only-of-type
- :last-of-type
- :first-of-type
- :nth-last-of-type()
- :nth-of-type()
- :nth-last-child()
- :selected
- :checked
- :file
- :button
- :reset
- :image
- :submit
- :checkbox
- :radio
- :password
- :text
- :input
- :parent
- :has()
- :contains()
- :header
- :lt()
- :gt()
- :eq()
- :odd
- :even
- :last
- :first
- [attributeFilter1][attributeFilter2]
- [attribute*=’value’]
- [attribute$=’value’]
- [attribute^=’value’]
- [attribute!=’value’]
- [attribute=’value’]
- [attribute]
- :not()
- :empty
- :only-child
- :last-child
- :first-child
- 兄弟セレクタ
- 隣接セレクタ
- 子セレクタ
- 子孫セレクタ
- グループセレクタ
- classセレクタ
- idセレクタ
- 要素セレクタ
- ユニバーサルセレクタ