jQueryの親子孫セレクター

❮jQueryセレクター

<div>要素の子孫であるすべての<span>要素を選択します。

$("div span")

定義と使用法

(「親の子孫」)セレクターは、指定された要素の子孫であるすべての要素を選択します。

要素の子孫は、その要素の子、孫、曽孫などである可能性があります。


構文

("parent descendant")

Parameter Description
parent Required. Specifies the parent element to be selected
descendant Required. Specifies the descendant element (of the specified parent element) to be selected

自分で試してみてください-例


すべての<li>要素を選択する方法。


❮jQueryセレクター