title: How to check if an element is empty using jquery?
body: <p>I want to call a function only if HTML of a <code>td</code> is empty (like <code>td</code> with <code>contenteditable='true'</code>), using jQuery.
  <strong>Note</strong> that you should <strong>not consider line breaks and spaces</strong>.
  How can i do something only if </p>
  
  <pre><code>&lt;table&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td contenteditable="true"&gt;
          &lt;br type="_moz"&gt;&lt;/br&gt;
        &lt;/td&gt;
        &lt;td contenteditable="false"&gt;2&lt;/td&gt;
        &lt;td contenteditable="false"&gt;3&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td contenteditable="false"&gt;4&lt;/td&gt;
        &lt;td contenteditable="true"&gt;
          &lt;br type="_moz"&gt;&lt;/br&gt;
        &lt;/td&gt;
        &lt;td contenteditable="true"&gt;
          &lt;br type="_moz"&gt;&lt;/br&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <hr>
  
  <p>None of the belows works :</p>
  
  <pre><code>if ($('#element').is(':empty')){
    //do something
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>if($.trim($("selector").html())=='')
  </code></pre>