title: how can check the value of checkbox group in jquery the action from dropdown
body: <p>I need to check the checkbox by matching it's value to the selected value of the <code>select</code>.</p>
  
  <p>For example, if I select the country name <code>USA</code> the checkbox labelled <code>USA</code> should be automatically checked. </p>
  
  <p>Below is what I have tried:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
          &lt;script&gt;
              $(document).ready(function(){
                  $(".e_p_country").change(function() {
                      var len = $('input[id="chk_c"]').length;
                      $('input[name="chk_c"]').each(function(len) {                 
                          if ($(this).val()==$(input[id="chk_c"]).val()) {
                              $('input[name="chk_c"]').attr('checked',true);
                          }
                          else {
                              $('input[name="chk_m"]').attr('checked',false);
                          }
                      });
                  });
              });
          &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;p&gt;
              Country:
              &lt;select id="e_p_country" class="e_p_country" name="e_p_country"&gt;
                  &lt;option value=""&gt;Select&lt;/option&gt;
                  &lt;option value="91"&gt;India&lt;/option&gt;
                  &lt;option value="65"&gt;Singapore&lt;/option&gt;
                  &lt;option value="1"&gt;USA&lt;/option&gt;
              &lt;/select&gt;
          &lt;/p&gt;
          &lt;input type="checkbox" class="chk_c" value="1" id="chk_c"&gt;USA
          &lt;input type="checkbox" value="65" id="chk_c"&gt;Singapore
          &lt;input type="checkbox" value="91" id="chk_c"&gt;India
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How can I do this?</p>