Not returning nan for two vars

Not returning nan for two vars

I've stopped my boxes displaying nan for the top two boxes when letters are entered into them. I when enter in letters into the third box and then a number into box 1. or 2. I get nan. Its probably really easy but I can't work it out?

1.<input type="text" id="first"/> 2.<input type="text" id="second" /> 3.<input type="text" id="third" value="10"/> $(document).ready(function(){ var num = 5; $('#first').keyup(function(){ var firstValue = parseFloat($('#first').val()); var thirdValue = parseFloat($('#third').val()); if(!isNaN(firstValue)) $('#second').val(firstValue * thirdValue / num); }); $('#second').keyup(function(){ var secondValue = parseFloat($('#second').val()); var thirdValue = parseFloat($('#third').val()); if(!isNaN(secondValue)) $('#first').val(secondValue / num * thirdValue); }); $('#third').keyup(function(){ var firstValue = parseFloat($('#first').val()); var secondValue = parseFloat($('#second').val()); var thirdValue = parseFloat($('#third').val()); if(!isNaN(thirdValue)) $('#first').val(secondValue / num * thirdValue); if(!isNaN(thirdValue)) $('#second').val(firstValue * thirdValue / num); }); });
http://jsfiddle.net/n00bctrl/vory55ze/#&togetherjs=bffzvEK5wS