如果字段A中的金额高于字段B中的金额,希望显示一个通知框。
目前有一些代码可以工作,但是通知框的开关并不取决于实际金额。
我错过了什么?
JQuery:
$(document).ready(function() {
$('#fieldA').change(function(){
if($(this).val()>$('#fieldb').val()){
//display it on the form
$('.labelNotification').toggle();
$('.labelNotification').append('Not recommended to have <em>FieldA</em> figure higher than <em>FieldB.</em>');
}
})
});
HTML:
<p style="display: none;" class="error labelNotification">