What I am trying to do is highlight a row in a repeatable row table based on a value greater than 0 in the totals field. And I'm trying to do this for multiple tables within the form. So far I've been able to highlight all the rows but it only works when you change the first row total. I tried to modify the javascript from an example laserfiche provides to do purchase order totals, but I'm stuck. This is what I have so far.
$('.cf-table-block tbody tr').on('blur', 'input', highlight); function highlight(){ $('.cf-table-block tbody tr').each(function(){ var t = 0; t = parseNumber($(this).find('.total input').val()); if (t > 0) { $('.highlight').css("background", "yellow"); } else if (t = 0){ $('.highlight').css("background", "none"); } }); } function parseNumber(n){ var f = parseFloat(n); return isNaN(f) ? 0 : f; }
I have a line in the code that adds the highlight class to all the tr elements and I know that's going to add the highlighting to all the elements but at that point after so many hours of trying I just wanted to see something work. Any help would be greatly appreciated. Thanks!