I have a input for phone number, and its type is not number is text, and I want to check if the input has characters to validate it as wrong, I have set it like that because I put a format to the input like 123-123-1234
here is my input
<input (keyup)="format()" (change)="format()" maxlength="12" inputmode="numeric" type='text' class="input" formControlName="celular" id="celular" name="celular">
Here is my ts where I set the format
format(){
$('#celular').val($('#celular').val().replace(/^(d{3})(d{3})(d+)$/, "$1-$2-$3"));
}
so what I want to do, is to know if the value of my input has characters from aA-zZ and some specials characters that are not –
3
Answers
I have found the solution
this gives true or false depending if the var a has any character from a-z and A-Z
With a little help from google i found this:
You can use html regex pattern for validating input fields
Example:
Format used in this example is 123-123-1234