var canAssignMultiple="true";
var canWithdrawMultiple="true";
function onCheckUncheck()
{
if($(':checkbox[name^="checkedRecords"]:checked').length>0)
{
$("input[name='checkedRecords']:checked").each(function()
{
debugger;
var canAssign = $(this).attr("canAssign").toLowerCase();
var canWithdraw = $(this).attr("canWithdraw").toLowerCase();
canAssignMultiple= canAssignMultiple && canAssign;
canWithdrawMultiple= canWithdrawMultiple && 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");
}
}
可變canAssignMultiple是變真當每個()函數被稱爲第二時間儘管其值已更改爲虛假在第一iteration.It應保留其值evrytime環路runs.How去做這個?變量不更新其值
恐怕字符串'「false」'是真的。也許你在HTML中使用'canAssign = false'? –
你的意思是'canAssignMultiple'成爲字符串''true''嗎? – LarsH
正如Jan提到的那樣,請向我們展示一個HTML樣本,以便我們可以看到'canAssign'屬性的值。 – LarsH