Html, Tutorial

Maxlength for Input Type=”number” in Chrome

Less than a minute to read

Ada beberapa cara yang dapat dicontoh dari referensi berikut : https://stackoverflow.com/questions/18510845/maxlength-ignored-for-input-type-number-in-chrome

Saya menggunakan kode berikut. Untuk maksimal digit 16 di form pengisian Nomor Induk Kependudukan (KTP).

<div class="form-group">
<label><b>NOMOR INDUK KTP</b></label>
<input type="number" pattern="/^-?\d+\.?\d*$/" onKeyPress="if(this.value.length==16) return false;" / class="form-control" name="nik_ktp" placeholder="" required>
</div>

Semoga bermanfaat.


Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

7 − three =

Related Posts

Html, Tutorial

Maxlength for Input Type=”number” in Chrome

Less than a minute to read

There are several ways that can be copied from the following references: https://stackoverflow.com/questions/18510845/maxlength-ignored-for-input-type-number-in-chrome I used the following code.
For a maximum of 16 digits in the form for filling in the Population Identification Number (KTP).

<div class="form-group">
<label><b>NOMOR INDUK KTP</b></label>
<input type="number" pattern="/^-?\d+\.?\d*$/" onKeyPress="if(this.value.length==16) return false;" / class="form-control" name="nik_ktp" placeholder="" required>
</div>

Good luck.


Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

12 − six =

Chat!
1