title: Javascript onclick form validation
body: <p>Can someone tell me what I am doing wrong over here.. Its printing out alert when I put character like abc but when I have valid number its not saving...</p>
  
  <pre><code>function ValidateNumeric() {
      var val = document.getElementById("tbNumber").value;
      var validChars = '0123456789.'; 
  
      for(var i = 0; i &lt; val.length; i++) { 
        if(validChars.indexOf(val.charAt(i)) == -1)
         alert('Please enter valid number');
         return false; 
          } 
  
          return true; 
      }
  
  &lt;INPUT TYPE=SUBMIT NAME="action" VALUE="Save Changes" onclick="return ValidateNumeric();" &gt;
  </code></pre>