Anyone know how I can get the following to limit the decimals to 2 places? There's also a problem that it displays NaN when there are no values in the two fields (I'd rather it just show nothing). Can anyone help fix these problems?
HTML
<td class="grade">
    <input type="text" value="28" class="numerator" /> / <input type="text" value="30" class="denominator" />
    <div class="result"></div>
</td>
jQuery
function update($ele) {
    var n = Number($ele.find('.numerator')[0].value);
    var d = Number($ele.find('.denominator')[0].value);
    $ele.find('.result').text(n / d * 100);
}
$('.grade').each(function() {
    update($(this));
});
$('.grade input').on('keyup', function() {
    update($(this).closest('.grade'));
});
 
    