jQuery :last-childセレクター

jQuery 选择器jQuery セレクター

例

親要素の最後の <p> 子要素を選択します。

$("p:last-child")

試してみる »

定義と使い方

:last-child セレクターは、親要素の最後の子要素を選択します。

ヒント:使用してください:first-childセレクターを使用して、親要素の最初の子要素を選択します。


構文

$(":last-child")


实例

試してみる - 例

すべての <div> 要素の最後の <p> 要素を選択します。
すべての <div> 要素の最後の <p> 要素を選択する方法。

:last と :last-child の違い
:last セレクターと :last-child セレクターの違いを示します。

:last、:last-child、:last-of-type の違い
:last、:last-child、:last-of-type セレクターの違いを示します。


jQuery 选择器jQuery セレクター

その他の拡張