내 클릭 제출 기능은 다음과 같습니다. aAmt는 예를 들어와 같은 $ 필드입니다. $ 45.00 a_amount는 항상 10000입니다. displayCurrencyFormat 함수에서 a_amount를 $로 변환 중입니다.2 개의 정수를 비교하는 jquery
그 다음 parseInt로 변환하고> = comaprison을 수행하면 실패합니다. aAmt가> $ 10000이고 컨피 런스가 경고 메시지를 표시해야하는 경우에도 마찬가지입니다.
$("#submitId").click(function() {
var aAmt = $("#aAmt").val();
var a_amount = "${dAmt}";
a_amount = displayCurrencyFormat(a_amount);
var pLen = $("#pOd").val();
if ((parseInt(aAmt) >= parseInt(a_amount)) && (pLen.length == 0)) {
$('#pDiv').text('Please provide a password');
$("#pOd").focus();
return false;
}
...//
});
function displayCurrencyFormat(a_amount)
{
//convert amount to currency format
var nbrAmt = Number(a_amount.replace(/[^0-9\.]+/g,""));
var fmtAmt = '$' + nbrAmt.toFixed(2).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
return fmtAmt;
}
당신이' "$ {dAmt} ''주십시오의 의미를 설명 할 수 있습니까? – BobRodes
$ {dAmt} = 10000은 DB에서 가져옵니다. – JNPW