I am new to Javascript so naturally I am having some issues with inputting the code correctly to get the behavior I want. I have two fields (Current and Previous MPG). I need for an alert to display if the Current MPG is less than the Previous MPG. With some assistance from a colleague I input this into the JS field. But when I test I do not see the alert displayed.
Am I missing something or am I doing this incorrectly?
$('#q671 input').change(function () { var x = $('#q671 input').val(); var y = $('#q672 input').val(); if (x > y) { alert("Current fuel economy must be higher than Previous fuel economy"); return false; } }) $('#q672 input').change(function () { var x = $('#q671 input').val(); var y = $('#q672 input').val(); if (x > y) { alert("Current fuel economy must be higher than Previous fuel economy"); return false; } })