title: jQuery: Wildcard class selector in removeClass
body: <p>This code snippet works to remove an existing class, before adding a new one, when I specify it directly (ie, 'ratingBlock', 'ratingBlock1', 'ratingBlock2', etc.). But when I use a wildcard selector in the removeClass ('[class^="ratingBlock"]'), it doesn't work. Am I doing something wrong? Thanks.</p>
  
  <pre><code>&lt;style type="text/css"&gt;
  .ratingBlock {background:gold !important;}
  .ratingBlock1, .ratingBlock2, .ratingBlock3, .ratingBlock4, .ratingBlock5 {background:LightGreen;}
  &lt;/style&gt;
  
  &lt;div class="test block ratingBlock"&gt;
  Broken
  &lt;div&gt;&lt;a href="#" class="ratingLink ratingNo-1"&gt;1+&lt;/a&gt;&lt;/div&gt;
  &lt;div&gt;&lt;a href="#" class="ratingLink ratingNo-2"&gt;2+&lt;/a&gt;&lt;/div&gt;
  &lt;div&gt;&lt;a href="#" class="ratingLink ratingNo-3"&gt;3+&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  // &lt;![CDATA[
  jQuery(document).ready(function(){
      initRatingWorks();
  });
  
  function initRatingWorks() {
      jQuery("a.ratingLink").bind('click', function() {
        var star = jQuery(this);
        var ratingBlock = star.parents('div.test.block');
        var rating = star.attr('class').match(/\d+/);
  
        if (ratingBlock.attr('class').indexOf('ratingBlock') !== -1) {
            ratingBlock.removeClass('[class^="ratingBlock"]').addClass('ratingBlock' + rating);
        }
        else {
            ratingBlock.addClass('ratingBlock' + rating);
        }
  
        return false;
      });
  }
  // ]]&gt;
  &lt;/script&gt;
  </code></pre>