This assumes your table has a class name of myTable (lines 3 and 4), and your fields have class names of columnB (line 8) and columnC (line 10). This also assumes you are doing integer comparison (the two parseInt functions on line 13 - if your values are decimal numbers, then use parseFloat instead of parseInt). This also assumes you are using the table element instead of the collection element.
CSS:
.yellow {background-color: yellow!important;}
Javascript to highlight field B:
$(document).ready(function () {
$('.myTable').change(addYellowToInputs);
$('.myTable').click('.cf-table-add', addYellowToInputs);
function addYellowToInputs()
{
$('.columnB input').each(function() {
var bValue = $(this).val();
var cValue = $(this).closest('tr').find('.columnC input').val();
if(parseInt(bValue) > parseInt(cValue))
{
$(this).addClass('yellow');
}
else
{
$(this).removeClass('yellow');
}
});
}
});
Javascript to highlight the row:
$(document).ready(function () {
$('.myTable').change(addYellowToRows);
$('.myTable').click('.cf-table-add', addYellowToRows);
function addYellowToRows()
{
$('.columnB input').each(function() {
var bValue = $(this).val();
var cValue = $(this).closest('tr').find('.columnC input').val();
if(parseInt(bValue) > parseInt(cValue))
{
$(this).closest('tr').addClass('yellow');
}
else
{
$(this).closest('tr').removeClass('yellow');
}
});
}
});