0
How to make Id card pattern?
I want to make Id card 15 digit pattern in input tag. If numbers exceed limit 15 then it show error if numbers less than 15 then it show error msg
2 Respuestas
+ 1
What value do you use for the 'type' attribute of the <input>?
For limiting maximum number of characters allowed you can set 'maxlength' attribute e.g. maxlength = "15"
But this only limits the maximum number of characters (prevents entering more than the limit - 15). And this doesn't work if <input> 'type' attribute is number.
One way or another, you will have to code the validation to check when the input was less than 15 characters.
+ 1
var input = document.getElementById(“input”);
input.onchange = function(){
if(input.value.length!=15){
errorFunction();
};
};