jQuery :only-childSelector

jQuery 选择器jQuery Selectors

Example

Select every <p> element that is the only child of its parent:

$("p:only-child")

Try it Yourself »

Definition and Usage

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


Syntax

$(":only-child")


jQuery 选择器jQuery Selectors

Other Extensions