title: jQuery: check if a div contains a div with class on
body: <p>I have several <code>&lt;div&gt;</code> elements inside another <code>&lt;div&gt;</code>.</p>
  
  <p>I want to do an <code>if</code> statement which is <em>true</em> if a div inside the top div contains class on.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="toDiv"&gt;
      &lt;div&gt;
  
      &lt;/div&gt;
      &lt;div class="on"&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>if ($(".toDiv").contains("on")) {
      // do something
  }
  </code></pre>