title: How to prevent user to enter more than two digit after decimal?
body: <p>Below is my textbox:</p>
  
  <pre><code>&lt;input type="number" id="payement-textbox'+index+'" name="payment-textbox" min="0" max="100000" step="any" maxlength="9" class="payment" placeholder="--" value=""/&gt;;
  </code></pre>
  
  <p>There are two validation on my number type textbox. First is user cannot enter value bigger than 99999.99 which I applied successfully.
  The other one is that user cannot enter more than two digits after decimal which is not working.</p>
  
  <p>Here is my jQuery code:</p>
  
  <pre><code>$('input.payment').on("change paste keyup", function(event) {
            var max = parseFloat($(this).attr('max'));
            var num = parseFloat($(this).val());
            if ( num &gt;= max)
            {
                $(this).val("99999.99");
            }  
            if( ($(this).val().indexOf('.') != -1) &amp;&amp; ($(this).val().substring($(this).val().indexOf('.')).length &gt; 2))
            {
            event.preventDefault();
            }
  
          }); 
  </code></pre>
  
  <p>Could you please tell me where I am going wrong?</p>