Removing an item from a list having a particular class using Jquery
<p>I have a dropdown, which when a particular option is selected removes an item from a list which has a certain class. However, my remove command:
 $('#coll-grouped-list li').hasClass('timeGroup').remove();
doesn't seem to work. Any ideas?</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;select id="tGroup" name="tGroup" class="standard_select" style="width:200px;"&gt;
                  &lt;option value=""&gt;Please Select&lt;/option&gt;
                  &lt;option value="hourGroup"&gt;Group by Hour&lt;/option&gt;
                  &lt;option value="dayGroup"&gt;Group by Day&lt;/option&gt;
                  &lt;option value="weekGroup"&gt;Group by Week&lt;/option&gt;
                  &lt;option value="monthGroup"&gt;Group by Month&lt;/option&gt;
                  &lt;option value="yearGroup"&gt;Group by Year&lt;/option&gt;
                &lt;/select&gt;

&lt;ul id="coll-selected-list" class="droptrue sort-drop"&gt;
              &lt;/ul&gt;
&lt;ul id="coll-grouped-list" class="droptrue agg-drop"&gt;
              &lt;/ul&gt;
</code></pre>

<p><strong>JS</strong></p>

<pre><code>$('#tGroup').bind('change', function (e) { 
        if( $('#tGroup').val() == 'hourGroup') {
          $('#coll-grouped-list li').hasClass('timeGroup').remove();
          $("#coll-grouped-list").append('&lt;li class="timeGroup"&gt;Hour&lt;/li&gt;');
        }
        if( $('#tGroup').val() == 'dayGroup') {
          $('#coll-grouped-list li').hasClass('timeGroup').remove();
          $("#coll-grouped-list").append('&lt;li class="timeGroup"&gt;Day&lt;/li&gt;');
        }         
      });
</code></pre>
