title: jquery if div id has children
body: <p>This <code>if</code>-condition is what's giving me trouble:</p>
  
  <pre><code>if (div id=myfav has children) {
     do something
  } else {
     do something else 
  }
  </code></pre>
  
  <p>I tried all the following:</p>
  
  <pre><code>if ( $('#myfav:hasChildren') ) { do something }
  if ( $('#myfav').children() ) { do something }
  if ( $('#myfav:empty') ) { do something }
  if ( $('#myfav:not(:has(*))') ) { do something }
  </code></pre>