jQuery –子孫セレクターの例
jQuery descender selector (X Y)は、「X」要素の子、孫、ひ孫、ひ孫..(任意のレベルの深さ)である「Y」に一致するすべての要素を選択するために使用されます。
例えば、
-
$(‘#container div’) –コンテナのIDを持つ要素の子孫である
に一致するすべての要素を選択します。$(‘form input’) –
jQueryの例
この例では、jQueryの子孫セレクターを使用して、「赤い枠線」を
jQuery descendant selector example jQuery child selector example
I'm form siblings #1 - DIVI'm form siblings #2 - P
I'm form siblings #3 - DIVI'm form siblings #4 - P