<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='docs.xsl'?>
<docs>
<method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing the unique parents of the matched
set of elements.' name='parent'>
<desc>Get a set of elements containing the unique parents of the matched
set of elements.

You may use an optional expression to filter the set of parent elements that will match.</desc>
<params type='String' name='expr'>
<desc>(optional) An expression to filter the parents with</desc>
</params>
<examples>
<desc>Find the parent element of each paragraph.</desc>
<before>&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;</before>
<code>$("p").parent()</code>
<result>[ &lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt; ]</result>
</examples>
<examples>
<desc>Find the parent element of each paragraph with a class "selected".</desc>
<before>&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;&lt;div class="selected"&gt;&lt;p&gt;Hello Again&lt;/p&gt;&lt;/div&gt;</before>
<code>$("p").parent(".selected")</code>
<result>[ &lt;div class="selected"&gt;&lt;p&gt;Hello Again&lt;/p&gt;&lt;/div&gt; ]</result>
</examples>
</method></docs>
