title: jquery if checkbox value = 2 selected
body: <p>I want to make a judge, if <code>checkbox value = 2, selected.</code> But now my judge not work.  </p>
  
  <p>Jquery part</p>
  
  <pre><code>if($('#select input').attr('value')=='2'){
      $('#select input').attr('checked','checked');
  }
  </code></pre>
  
  <p>Html part</p>
  
  <pre><code>&lt;div id="select"&gt;
  &lt;input type="checkbox" name="my_check[]" value="1"&gt;item1&lt;/input&gt;
  &lt;input type="checkbox" name="my_check[]" value="2"&gt;item2&lt;/input&gt;
  &lt;input type="checkbox" name="my_check[]" value="3"&gt;item3&lt;/input&gt;
  &lt;input type="checkbox" name="my_check[]" value="4"&gt;item4&lt;/input&gt;
  &lt;input type="checkbox" name="my_check[]" value="5"&gt;item5&lt;/input&gt;
  &lt;/div&gt;
  </code></pre>