title: Check if checkbox is NOT checked on click - jQuery
body: <p>I want to check if a checkbox just got unchecked, when a user clicks on it. The reason for this is because i want to do a validation when a user unchecks a checkbox. Because atleast one checkbox needs to be checked. So if he unchecks the last one, then it automatically checks itself again.</p>
  
  <p>With jQuery i can easily find out wether it's checked or not:</p>
  
  <pre><code>$('#check1').click(function() {
      if($(this).is(':checked'))
          alert('checked');
      else
          alert('unchecked');
  });
  </code></pre>
  
  <p>But i actually only want to have an if statement that checks if a checkbox just got unchecked.</p>
  
  <p>So i thought i could do that with the following code:</p>
  
  <pre><code>$('#check2').click(function() {
      if($(this).not(':checked'))
          alert('unchecked');
      else
          alert('checked');
  });
  </code></pre>
  
  <p>But this will always show the 'unchecked' message. Not really what i was expecting...</p>
  
  <p><strong>demo:</strong> <a href="http://jsfiddle.net/tVM5H/" rel="noreferrer">http://jsfiddle.net/tVM5H/</a></p>
  
  <p>So eventually i need something like:</p>
  
  <pre><code>$('#check2').click(function() {
      if($(this).not(':checked')) {
          // Got unchecked, so something!!!
      }
  });
  </code></pre>
  
  <p>But obviously this doesn't work. I rather don't want to use the first example, because then i'd have an unnecessary 'else' statement when i only need one 'if' statement.</p>
  
  <p>So first thing, is this a jQuery bug? Cause to me it's unexpected behaviour. And second, anyone any ides for a good alternative?</p>