title: Getting the value of current checkbox from a group of checkboxes with same class name
body: <p>I'm trying to get the value of the current checkbox from a group of checkboxes with the same class name as below. However the jquery code seems to not be acting out accordingly. Could anyone help me out with this?</p>
  
  <p><a href="http://jsfiddle.net/m8fdc/2/" rel="nofollow">http://jsfiddle.net/m8fdc/2/</a></p>
  
  <p>HTML</p>
  
  <pre><code>&lt;input type="checkbox" class="checkbox1" value="test"/&gt;&lt;br /&gt;
  &lt;input type="checkbox" class="checkbox1" value="test2"/&gt; &lt;br /&gt;
  &lt;input type="checkbox" class="checkbox1" value="test3"/&gt; 
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$(document).ready(function() {
      //set initial state.
  
      $('.checkbox1').click(function() {
          if ($(this).is(':checked')) {
              console.log($('.checkbox1').val());
          }
      });
  });
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Thank you.</p>