title: jquery each match not work
body: <p>In anyway, I want make a judge, if div's id match something, then add class to it. My code here, but each match not work. pls help, thx.</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      var num = '3';
      $('.ddd').each(function(){
          if($(this).attr('id').match(/^'id'+num$/)){
              $(this).addClass('eee');
          }
      });
  });
  &lt;/script&gt;
  &lt;style&gt;
  .ddd{float:left;display:block;background:#9FF;width:50px;height:50px;margin:10px;}
  .eee{background:#F36!important;}
  &lt;/style&gt;
  &lt;div class="ddd" id="id1"&gt;&lt;/div&gt;
  &lt;div class="ddd" id="id2"&gt;&lt;/div&gt;
  &lt;div class="ddd" id="id3"&gt;&lt;/div&gt;
  &lt;div class="ddd" id="id4"&gt;&lt;/div&gt;
  &lt;div class="ddd" id="id5"&gt;&lt;/div&gt;
  &lt;div class="ddd" id="id6"&gt;&lt;/div&gt;
  &lt;div class="ddd" id="id7"&gt;&lt;/div&gt;
  </code></pre>