I have an input with maxLength of 1. I want that if I type another value (key) the current value (letter) that inside the input will be replaced with the new value (letter of key).
I've tried something like that:
container.addEventListener('keyup', function (e) {
var target = e.srcElement || e.target;
var letter = target.value;
var newLetter = letter.replace(/letter/g, letter);
letter.value = newLetter;
});