zero to the left of the number (type number)

0
<input oninput="if (this.value.length > this.maxLength)
 this.value = this.value.slice(0, this.maxLength);
 validity.valid||(value='');" min="0" step="1" type="number"
 maxlength="9" formControlName="quantity" class="form-control"
 [ngClass]="item.controls['quantity'].errors ? 'has-error' : ''"
 (keydown)="onValueOrQuantityChanged(item)"
 (keyup)="onValueOrQuantityChanged(item)">

I have the above html code which inserts an input of type NUMBER. Together it has a javascript code that assures that I do not enter more than 9 numbers.

The problem is that when my application runs in Firefox, entering zero (s) to the left is discarded after entering the 9 numbers.

Ex. when entering "000999999", the zeros are discarded and I can enter 3 more numbers at the end of the value. But I want to keep those zeros.

NOTE: This is only happening in Firefox.

    
asked by anonymous 24.09.2018 / 22:34

0 answers