Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery :only-child Selector

jQuery :only-child Selector

jQuery selector jQuery selector

Example

Select every element that is the only child of its parent

element:

$("p:only-child")

Try it »


Definition and Usage

The :only-child selector selects every element that is the only child of its parent.


Syntax

$(":only-child")


jQuery selector jQuery selector