title: jQuery - Checked or unchecked value? Filtering
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8391084/how-to-check-if-check-box-is-checked-in-this-example-javascript-jquery">How to check if check box is checked in this example (javascript/jQuery.)</a>  </p>
  </blockquote>
  
  
  
  <p>I've ran into a problem with my checkboxes. I'm trying to set off an event if the button is clicked differing the action whether it is checked or not checked. </p>
  
  <p>Here's my code</p>
  
  <pre><code>$(document).ready(function(){
  
  $('.pointBox').click(function(event){
      var operator = $(this).find('input').attr('operator');
      var pointNum = parseInt($(this).find('input').val());
      var pointsFromHtml = $('#newPoints').val();
      var currentPoints;
      var newPoints;
  
      if(pointsFromHtml.charAt(0) == '+'){
          currentPoints = parseInt(pointsFromHtml.substring(1));
      } else {
          return;
      }
  
      switch(operator){
  
          case 'addition':
              if(!$(this).attr('checked')){
                  newPoints = currentPoints + pointNum;
              }
              if($(this).attr('checked')){
                  alert();
                  newPoints = currentPoints - pointNum;
              }
              break;
          case 'subtraction':
              newPoints = currentPoints - pointNum;
              break;
      }
  
      $('#futurePoints').text('+' + newPoints);
      $('#newPoints').attr('value', newPoints);
  
  });
  
  });
  </code></pre>