how to check parent in jquery
<p>I bind a click event over the <code>document</code>. I have a div with id <code>parent</code>. Now whenever the click event occur over the <code>document</code> than i am trying to check the target element is the child of <code>div ( id = parent )</code> or not.</p>

<pre><code>   &lt;div id="parent"&gt;
    &lt;div id="c1"&gt;
     &lt;div id="gc1"&gt;
     &lt;/div&gt;
     &lt;div id="gc2"&gt;
     &lt;/div&gt;
     ...
    &lt;/div&gt;
    ...
   &lt;/div&gt;
</code></pre>

<p>For this purpose i wrote the following jquery code :</p>

<pre><code>$(document).click( function(e) {
     if($(e.target).parents("#parent").length &gt; 0)  //this condition is not 
                                                      working as expected
     { }
});
</code></pre>

<p>What i am doing wrong here?</p>
