How can I determine whether a checkbox is checked in jQuery? : <p>I dynamically create a bunch of checkboxes like so:</p>

<pre><code>@foreach (var rpt in reports)
{
    @* convert id to lowercase and no spaces *@
    var morphedRptName = @rpt.report.Replace(" ", string.Empty).ToLower();
    &lt;input class="leftmargin8, ckbx" id="ckbx_@(morphedRptName)" type="checkbox" value="@rpt.report" /&gt;@rpt.report
}
</code></pre>

<p>I've got this event handler where I want to determine their state - checked or unchecked:</p>

<pre><code>$(".ckbx").change(function () {
    if ($(this).checked) {
        alert('checkbox is unchecked');
        checkboxSelected = false;
        return;
    }
    alert('checkbox is checked');
    . . .
</code></pre>

<p>However, the condition "if ($(this).checked)" is <em>always</em> false, both when I check a checkbox and when I subsequently uncheck/deselect it.</p>

<p>So what do I need to do to determine when it is unchecked? I actually tried this first: "if (!$(this).checked)" but that just did the reverse - the condition was always true.</p>
