title: Allow only numbers or decimal point in form field
body: <p>I've limited the input field to only numbers through js but am not sure how to also allow decimals...</p>
  
  <pre><code>function isNumberKey(evt)
        {
           var charCode = (evt.which) ? evt.which : event.keyCode
           if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57))
              return false;
  
           return true;
        }
  </code></pre>
  
  <p>Thank you in advance!</p>
  
  <p>Answer:</p>
  
  <pre><code>function isNumberKey(evt)
   {
   var charCode = (evt.which) ? evt.which : event.keyCode
   if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57) &amp;&amp; charCode != 46)
      return false;
  
   return true;
   }
  </code></pre>
  
  <p>Adding the charCode 46 worked perfectly (keypress value). 190 and 110 did nothing.</p>
  
  <p>Thanks for your help all!</p>