Possible Duplicate:
Can I change the <td> background if a field result is great or equal to another field?
Trying to get my script to work, displaying mySQl results in an HTML table via php with a particular column TD that contains $qty that needs to have its background turn red when it equals or passes $min or $max.
Maybe there's a better way to right this php?
Script is not working.
<script type="text/javascript">
$(document).ready(function() {
var min = parseInt($('.min').text());
var max = parseInt($('.max').text());
var qty = parseInt($('.quantity').text());
if (qty >= max || qty <= min ) {
$('.quantity').css('background-color', 'red');
}
});
</script>
My php table / the three fields are toward the end of the table:
$o .= '<tr><td>'.$type.'</td><td>'.$part_no.'</td><td>'.$description.'</td><td>'.$artwork.' </td><td><a href="/data/hero/copies/'.$part_no.'.pdf" target="_blank">Link </a></td><td align=right class="min">'.number_format($min).'</td><td align=right class="max">'.number_format($max).'</td><td align=right class="quantity">'.number_format($qty).'</td></tr>';}