title: Remove empty <li> using jQuery
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1520981/remove-empty-elements-with-jquery">Remove Empty elements with jQuery</a>  </p>
  </blockquote>
  
  
  
  <p>I want to remove empty <code>&lt;li&gt;</code> using jQuery. I am trying to do this but my code is not working as per my requirements. My code is show below.</p>
  
  <p><strong>Script</strong></p>
  
  <pre><code>$(document).ready(function(e) {
      $('#u li').each(function() {
          if($(this).html(' ')) {
              $(this).remove();
          }
      });
  });
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;ul id="u"&gt;
      &lt;li&gt;hi&lt;/li&gt;
      &lt;li&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>