:only-child
selectorThe jQuery :only-child
selector is used to select the element that is the only child element of their parent.
:only-child
selector Syntax$(':only-child')
:only-child
selector ExamplesIn below example,We will add background color for each p element that is the only child of its parent.