English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
:only-The :only child selector selects each element that is the only child of its parent element.
$(":only-child")
Select each <p> element that is the only child of its parent:
$(document).ready(function(){ $("p:only-child").css("background", "coral"); });Test and See‹/›