I'm trying to create a textbox can accepts only digits while the user types in it.
I am talking about a live situation, I don't need to check it only at submitting.
To do that, I have added the following attribute to my textbox:
pattern="[0-9]*"
However, it doesn't work: I can still enter any kind of character like "a", "b" and not only "0", "1".
What is my fault here?
Thank you!
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<input class="input {{fields[$index].class}}"
ng-disabled="field.disabled != ''"
ng-required="field.name == zipcode"
ng-model="fields[$index].value"
name="{{field.name}}"
type="text"
id="{{field.name}}"
maxlength="6"
pattern="[0-9]*"
>
<label placeholder=" {{field.label}}">
</label>