Now I am developing a bar code based attendance system . Any there any javascript event can solve once the text field has detected the value has 10 characters, the text field will be fired and i can able to get the value.
Is there any solution ?
Now I am developing a bar code based attendance system . Any there any javascript event can solve once the text field has detected the value has 10 characters, the text field will be fired and i can able to get the value.
Is there any solution ?
I'm not sure what you mean by "the text field will be fired", but you can find out when the 10th character is entered by binding to the keyup
event:
document.getElementById("example").onkeyup = function() {
if(this.value.length === 10) {
console.log("ok");
}
};
It would be better to use addEventListener
or attachEvent
rather than setting the onkeyup
property, but I'll leave that up to you.
Here's a working example.
you can check the length of the text input box value on every keypress and make a function call when its the 10th character.