When I put "123" value into input field it will convert properly to letter "ABC", but when I type "112" it only convert first number like this "A1B" I need "112" to be convert into "AAB". However, the repeated characters are not replaced.
function char_convert() {
var chars = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
var codes = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"];
for (x = 0; x < chars.length; x++) {
for (i = 0; i < arguments.length; i++) {
arguments[i].value = arguments[i].value.replace(chars[x], codes[x]);
}
}
}
char_convert(this);
<div id="test">
<input type="text" id="txtBox" onchange="char_convert(this);" />
</div>