Variable not updating its value
<pre><code>var canAssignMultiple="true";
var canWithdrawMultiple="true";

function onCheckUncheck() 
{
    if($(':checkbox[name^="checkedRecords"]:checked').length&gt;0)
    {
        $("input[name='checkedRecords']:checked").each(function()
        {
            debugger;
            var canAssign = $(this).attr("canAssign").toLowerCase();
            var canWithdraw = $(this).attr("canWithdraw").toLowerCase();
            canAssignMultiple= canAssignMultiple &amp;&amp; canAssign;
            canWithdrawMultiple= canWithdrawMultiple &amp;&amp; canWithdraw;
            if (canAssignMultiple == "false") 
                $("#assaignbutton").attr("disabled", "disabled");
            else 
                $("#assaignbutton").removeAttr("disabled");

            if (canWithdrawMultiple == "false") 
                $("#withdrawbutton").attr("disabled", "disabled");
            else
                $("#withdrawbutton").removeAttr("disabled");
        });
    }          
    else
    {
        $("#assaignbutton").attr("disabled", "disabled");
        $("#withdrawbutton").attr("disabled", "disabled");
    }
}
</code></pre>

<p>The variable canAssignMultiple is becoming true when each() function is called the second time though its value has changed to false in the first iteration.It should retain its value evrytime the loop runs.How to do this?</p>
