jquery event is not working properly
<p>i have a Invoice form and a jquery function.
In Invoice if i enter the quantity greater then the available quantity then i have to alert the user.</p>

<p>My problem is: Let the max quantity is 5, if i input data as 7 (single digit>max avail quantity) then my code is working fine. But if i enter two digigist number eg. 17(two digists>max avail quantity) then my alert box is not coming.
            I mean onkeyup my function is working  only with single digit.</p>

<p>How can i make it happening? Please help.</p>

<pre><code>      $('input[name="quantity"]').keyup(function() 
       {  
    //problem is here
        var $tr = $(this).closest("tr");
        var unitprice = $tr.find('input[name^="unitprice"]').val();

        var q = $tr.find('input[name^="quantity"]').val();
        var cq = $tr.find('input[name^="checkquantity"]').val();

        if(q&gt;cq)
      {
      alert("Error: Quantity value exceeds then available quantity..Max Quantity is "+cq);
          //this works fine only if single digit is entered in textbox quantity
       }

         //----below are some other stuffs -these are working fine
        $tr.find('input[name^="sprice"]').val($(this).val() * unitprice); 
        var totalPrice = 0;
        $('input[name="sprice"]').each(function()
        {
            totalPrice += parseFloat(this.value);
            $('[name=subtotal]').val(totalPrice);
        });  
    });  
    --------------
    ------------
   // Form containing the above textboxes
        &lt;input type="submit" id="submitbtnId" value="Save"/&gt;`
</code></pre>
