1.

What is a parent/child selector?

Answer»

<P>All ELEMENTS that are a direct child of the specified ELEMENT are SELECTED using the ("parent > child") selection.

Parameters:

  • Parent: This specifies the parent element to be selected.
  • Child: This specifies the direct child element (of the specified parent element) to be selected.

It chooses and returns all of the parent element's direct children.

Here is an example of how to use the jQuery parent > child selector: 

<html><body><h2>Sample Demo</h2><div><p>First line.</p><span>Middle line. (span outside of p element.) </span><p>LAST line. </p></div><br><div><p>First line.</p><p>Middle line. <span>span inside p element.</span></p><p>Last line. </p></div></body></html>


Discussion

No Comment Found