jQuery Percentage Compare (Work In Progress)
A little bit of experimental code to compare two percentages and then change the color of text based on the comparison. Created for www.hsc.wvu.edu/hsc2020
HTML
<table class="tjTable">
<tr>
<td class="Target">90%</td>
<td class="QuarterStatus">100% (121/121)</td>
<td class="QuarterStatus">91% (10/12)</td>
</tr>
<tr>
<td class="Target">90%</td>
<td class="QuarterStatus">100% (121/121)</td>
<td class="QuarterStatus">91% (10/12)</td>
</tr>
</table>
CSS
td {padding:10px; border:1px solid #ccc;}
JavaScript
$(function(){
var target = $('.Target');
var status = $('.QuarterStatus');
$('.tjTable tr').each(function(){
console.log($(this).find(target).html());
//$(this).find(target).html
// if (status > target) {
// status.css('color':'green');
// }
});
});
// Macaconla