title: document.getElementById.value not working
body: <p>I have a html page that has input fields for the user to enter the quantity of fruits. On key press/ key up, it is suppose to call the javascript file method and checks if it is a digit. If it is not a digit, the textbox field will be cleared. However, my textbox is not cleared when i tried to enter a non numerical value. Is there something missing in my code?</p>
  
  <p>Html</p>
  
  <pre><code>                    &lt;div class="form-group "&gt;
                          &lt;label class="control-label " for="name"&gt; Name &lt;/label&gt;
                          &lt;input class="form-control" id="name" name="name" type="text" /&gt; &lt;span class="help-block" id="hint_name"&gt; Enter your name &lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group "&gt;
                          &lt;label class="control-label" for="apple"&gt; Apple ( 69cents ) &lt;/label&gt;
                          &lt;input class="form-control form-control-input" id="apple" name="apple" type="text" autocomplete="off" onkeyup="isNumber(this,event)" /&gt; &lt;span class="help-block" id="hint_number"&gt; Enter Qty &lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group "&gt;
                          &lt;label class="control-label" for="orange"&gt; Orange ( 59cents ) &lt;/label&gt;
                          &lt;input class="form-control form-control-input" id="orange" name="orange" type="text" autocomplete="off" onkeyup="isNumber(this,event)" /&gt; &lt;span class="help-block" id="hint_number1"&gt; Enter Qty &lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group "&gt;
                          &lt;label class="control-label" for="banana"&gt; Banana ( 39cents ) &lt;/label&gt;
                          &lt;input class="form-control form-control-input" id="banana" name="banana" type="text" autocomplete="off" onkeyup="isNumber(this,event)" /&gt; &lt;span class="help-block" id="hint_number2"&gt; Enter Qty &lt;/span&gt;
                      &lt;/div&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code> function isNumber(idValue, evt) {
      evt = (evt) ? evt : window.event;
      var sum = 0;
      var costOfApple = 0;
      var costOfOrange = 0;
      var costOfBanana = 0;
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57)) {
          document.getElementById('idValue.id').value = "";
          document.getElementById('totalCost').value = "NaN";
          $("#invalid-alert").fadeTo(2000, 500).slideUp(500, function() {
              $("#invalid-alert").slideUp(500);
          });
      } else {
          costOfApple = document.getElementById('apple').value * 69;
          costOfOrange = document.getElementById('orange').value * 59;
          costOfBanana = document.getElementById('banana').value * 39;
          sum = (Number(costOfApple) + Number(costOfOrange) + Number(costOfBanana)) / 100;
          document.getElementById('totalCost').value = "$" + (sum).toFixed(2);
      }
  }
  </code></pre>