如何检查给定变量是否与另一个jQuery具有相同的值



我有两个字段,我想检查它们的值是否等于"current_outstanding_balance"。如果是,它会向字段"current_outstanding_balance_check"添加文本。当我在循环中添加一个var时,它就起作用了。但我试着添加更多类似的内容,但不起作用。if(overduer && overdue == fieldNameForResult)

这是我的代码:

function(){
var fieldNameForResult = thisPointer.entity.getValue('current_outstanding_balance');
var overduer = thisPointer.entity.getValue('additional_personnel_costs');
var overdue = thisPointer.entity.getValue('overdue');

if(overduer && overdue == fieldNameForResult){
jQ('[id="current_outstanding_balance_check"]').val('True' );

}else{
jQ('[id="current_outstanding_balance_check"]').val('False' );

}
} ```
Now I have no error, but it shows me "False" even though both fields are empty.

您需要添加对两个值的检查:

if(parseFloat(overduer) + parseFloat(overdue) == parseFloat(fieldNameForResult)){

最新更新