Limiting range of input field
<p>Though it is a very common question. I have one input field in which the data entered must be between 1 and 150.</p>

<p>Problem is I am already using some validations on that. That validation is being used by many other input fields. So I cannot change that. It is the <code>num()</code> function.</p>

<p>On one field <code>mesure</code> I want to add extra functionality. I tried it with validate.
I don't know how to merge these two validations for only one input field using both function in <code>document.ready</code>.</p>

<p>I can do it in either jQuery or PHP.</p>

<pre><code>&lt;input type="text" name='mesure' class="numbersonly" maxlength="3" onblur =" validate()"/&gt;


function num() {

    $(".numbersonly").bind('keypress', function(e) {

        if (e.which != 8 &amp;&amp; e.which != 0 &amp;&amp; (e.which &lt; 48 || e.which &gt; 57)) {

            $("#errmsg").html("numbers please");

            return false;
        }
    });

}

function validate()
{
   if( document.form.mesure.value &gt;150 )
   {
       alert( "out of range!" );
       document.form.mesure.focus() ;
       return false;
   }
}      
</code></pre>
