using jQuery/javascript to restrict price field input
<p>I found the following jQuery code on the internet, but I soon found that it had a deficiency in that it dit not accept a decimal point (ascii code 46) - even though the code appears to allow it.</p>

<p>Currently, I cannot enter prices like 1.23, since the the period is ignored and I get 123 instead.</p>

<p>Can anyone spot whty this is not working?</p>

<pre><code>// Numeric only control handler
$.fn.ForceNumericOnly =
function()
{
    return this.each(function()
    {
        $(this).keydown(function(e)
        {
            var key = e.charCode || e.keyCode || 0;

            // allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
            return (
                key == 8 ||
                key == 9 ||
                key == 46 ||
                (key &gt;= 37 &amp;&amp; key &lt;= 40) ||
                (key &gt;= 48 &amp;&amp; key &lt;= 57) ||
                (key &gt;= 96 &amp;&amp; key &lt;= 105));
        })
    })
};
</code></pre>

<p>I am using the plugin like this:</p>

<pre><code>$(function(){
  $('#price_field').ForceNumericOnly();
});
</code></pre>
