title: Take value for each check box if checked Javascript
body: <p>I still learning javascript, i think this is ez question, but i can't fix it with my experience (already try search some source), this my code</p>
  
  <p>This is example: </p>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php
      &lt;input type="checkbox" checked="checked" value="1" class="box_1"&gt;1&lt;/label&gt; // checked
      &lt;input type="checkbox" value="2" class="box_1"&gt;2&lt;/label&gt; //unchecked
      &lt;input type="checkbox" checked="checked" value="3" class="box_1"&gt;3&lt;/label&gt; // checked
      &lt;input type="checkbox" value="4" class="box_1"&gt;4&lt;/label&gt; //unchecked
      &lt;input type="checkbox" checked="checked" value="5" class="box_1"&gt;5&lt;/label&gt; // checked
  
  &lt;input type="button" value="Submit" id="button-price" class="button" /&gt;
  ?&gt;
  </code></pre>
  
  <p>I try check the check box with javasript by class, (i can't use by name&amp;id because i use looping)</p>
  
  <p>I try build condition like this Javascript :</p>
  
  <pre><code>$('#button-price').bind('click', function() {
      var box = '';
      $(".box_1").each(function(){      // for each checkbox in class box_1(1-5)
          if(this).attr("checked","true"){  // if this checked box is true
              var value = (this.value).toLowerCase();  // take the value 
              box = box + value;   // store to box
          }
      });
  });
  </code></pre>
  
  <p>when click button then take <code>value</code> and store to box, 
  I know there error in here <code>if(this).attr("checked","true"){</code> 
  what it should be writing the condition?</p>