title: jQuery choose children of e.target
body: <p>I have jQuery code that toggle class while I clicking on list element. 
  <em>It's okay if you click on list area</em>... 
  But when you click on <code>span</code> element, which has text "Element1", it is not working. </p>
  
  <ol>
  <li>I want use this jQuery function to only elements that have another
  <code>ul</code> as a child (<strong>Element1</strong>).</li>
  <li>I don't want to close dropdown menu by clicking any child <code>ul</code>
  elements.</li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(".sidebar&gt;ul&gt;li").has("ul").click(
    function(e) {
      if ((e.target == this)) {
        $(this).children("ul").toggleClass("toggle");
      }
    }
  );</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>  
  .sidebar ul li ul {
    display: none;
  }
  .sidebar ul li ul.toggle {
    display: block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="sidebar"&gt;
   &lt;ul&gt;
    &lt;li&gt;
      &lt;span&gt;Element1&lt;/span&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;a&gt;Subelement1&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;span&gt;Element2&lt;/span&gt;
    &lt;/li&gt;
   &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>