title: I want to restrict user to enter quantity which should not more then quantity in stock
body: <p>I want to restrict user to enter quantity which should not more then quantity in stock,iIn below JavaScript code <code>qty</code> is the quantity which I am fetching from server, and <code>#quantity</code> is the input box where I set default the value to <code>1</code>. I want that the user can not enter <code>quantity</code> more then <code>qty</code>.</p>
  
  <pre><code>select: function( event, ui ) {
      var names = ui.item.data.split("|");                        
      id_arr = $(this).attr('id');
      id = id_arr.split("_");
      $('#itemNo_'+id[1]).val(names[0]);
      $('#itemName_'+id[1]).val(names[1]);
      $('#packing_'+id[1]).val(names[3]);
      $('#qty_'+id[1]).val(names[4]);
      $('#quantity_'+id[1]).val(1);
      $('#discount_'+id[1]).val(0);   
      $('#price_'+id[1]).val(names[2]);
      $('#total_'+id[1]).val( 1*names[2] );
      calculateTotal();
  </code></pre>
  
  <p>hare is the HTML:</p>
  
  <pre><code>&lt;td&gt;
      &lt;input disabled type="number" name="data[0][qty]" id="qty_1" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"&gt;
  &lt;/td&gt;
  
  &lt;td&gt;
      &lt;input type="number" name="data[0][quantity]" id="quantity_1" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"&gt;
  &lt;/td&gt;
  </code></pre>