title: Return javascript field to default value after onkeyup
body: <p>I have two fields where the second field has a value and whatever value is entered in the first field is added to the second value.
  Now when it is added and the number entered in the first field is deleted(erased with backspace) the value of the second field does not not return to it's original value. How do I go about this? Also I won't mind a better way to approach <code>onkeyup</code> in this situation</p>
  
  <p>Html:</p>
  
  <pre><code>First: &lt;input type="text" id="vala"  onkeyup="sum();" /&gt;
  Second: &lt;input type="text" id="valb"  value="12" /&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>function sum() {
  var first = document.getElementById('vala').value;
  var second = document.getElementById('valb').value;
  var result = parseInt(first) + parseInt(second);
  if (!isNaN(result)) {
     document.getElementById('valb').value = result;
              }
          }
  </code></pre>
  
  <p>Working fiddle representation:
  <a href="http://jsfiddle.net/wcvqby2g/" rel="nofollow">http://jsfiddle.net/wcvqby2g/</a></p>