English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery :only-Sélecteur child

Sélecteurs jQuer

:only-child sélectionne chaque élément qui est l'unique enfant de son élément parent.

Le sélecteur :only

Syntaxe :-$(":only

Exemple

Sélectionnez chaque élément <p> qui est le seul enfant de son parent :

$(document).ready(function(){
  $("p:only-child").css("background", "coral");
});
Vérifiez le test‹/›

Sélecteurs jQuer