jQuery - 子セレクタの例

jQuery –子セレクターの例

jQuery child selector (X > Y)は、「X」要素の子である「Y」に一致するすべての要素を選択するために使用されます。

例えば、

  • $(‘form > input’)

    で一致する要素の子である、で一致するすべての要素を選択します。子要素のみが一致し、孫、ひ孫は一致しません。

jQueryの例

この例では、「textbox 1」と「textbox 4」のみが一致し(フォーム要素の子)、「textbox 2」(孫)と「textbox 3」(great孫)は一致しません。



jQuery child selector example



 






jQuery child selector example

I'm form siblings #1 - DIV

I'm form siblings #2 - P

I'm form siblings #3 - DIV

I'm form siblings #4 - P