Darshan Kini Darshan Kini - 1 year ago 44
HTML Question

Input field which accept only number with maxlength

<input type="number">

I want take only number from input field with maxlength is 8.please suggest me.


You could do that with jquery.

$('input[type=number]').keypress(function() {
      if (this.value.length >= 8) {
          return false;

you could replace the 'input[type=number]' with either an id or class and add the id or class to the input field.