title: Assigning action to Parent elements only, exclude child elements
body: <p>How to use jquery selectors to select parent only but exclude child</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="container"&gt;
    &lt;div class="element"&gt;
      &lt;img src="something.jpg"/&gt;
      &lt;a href="somelink"&gt;Some link&lt;/a&gt;
      &lt;p&gt;Blah blah...&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class="element"&gt;
      &lt;img src="something2.jpg"/&gt;
      &lt;a href="somelink2"&gt;Some link2&lt;/a&gt;
      &lt;p&gt;Blah blah...&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JQuery:</p>
  
  <p>How can I trigger alert("Hi") only if user clicks on (div "element") but not when &lt; a > and &lt; img > are clicked</p>
  
  <pre><code>                    $("#container").delegate(".element", "click", function(){
                          alert("Hi");
                      });
  </code></pre>