Darshan Kini Darshan Kini - 2 years ago 88
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download