I have a form that compares values in two fields. If there is a discrepancy it will show the discrepancy amount in a field. If the amount does not the same, it needs to turn the field red. If it is the same it needs to turn the field green. I am making the discrepancy field read only using JavaScript because I need the value available when it is saved in the repository. If I have the discrepancy field marked as read only using JavaScript it will not turn the field either color. If I do not mark the field as read only it works correctly. Below is the JavaScript I am currently using:
$('.GrossAmount, .GL_Coding_Total').change(function() { var invDollars = $(".GrossAmount input").val(); var totDollars = $(".GL_Coding_Total input").val(); if (invDollars != totDollars) { $('.discrepancy input').css('background-color', '#FF8888 !important'); $('.Approve').hide(); $('.Reject').hide(); $('.Submit').hide(); } else { $('.discrepancy input').css('background-color', '#B4EDB4'); $('.Submit').show(); $('.Approve').show(); $('.Reject').show(); } });
Anyone have any ideas what I've done wrong?