How can I check if a checkbox is checked on click?
<p>I need to trigger some code when I click a checkbox based on if a checkbox is checked or not. 
But for some reason, <code>.is(':checked')</code> is always triggered.</p>

<p>This is my code.</p>

<pre><code>  jQuery('#selectlist input[type=checkbox]').live('click',function(){
    var select_id = jQuery(this).attr('id');

    if(jQuery(this).is(':checked')) {
      alert('You have unchecked the checkbox');
      // Remove some data from variable
    } else {
      alert('You have checked the checkbox');
      //Add data to variable
    }
  }
</code></pre>

<p><strong>UPDATE</strong><br>
I've added an example on JSFiddle: <a href="http://jsfiddle.net/HgQUS/" rel="nofollow">http://jsfiddle.net/HgQUS/</a></p>
