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

jQuery :only-of-type Selector

jQuery Selectors

only-of-The type selector selects each element that is a unique child of its parent element of a specific type.

Syntax:

$(":only-of-type")

Example

Select each <p> element that belongs to its parent with a unique <p> element:

$("document").ready(function(){
  $("p:only-of-type").css("background", "coral");
});
Test See‹/›

jQuery Selectors