Javascript Validation
I want Aadhar number in the format of XXXX XXXX XXXX. The text box should take the input in this format automatically.
While entering the input the input should automatically convert into this(xxxx xxxx xxxx) format.
document.getElementById("id").addEventListener('keyup', function (e) {
if (e.keyCode !== 4) {
if (this.value.length === 4 || this.value.length === 9 || this.value.length === 19) {
this.value = this.value += ' ';
console.log(e.keyCode);
}
}
});