@edit If you do not want the user to enter these values as types, you can only check when the value is 2.
You can listen to the keydown event of the input element and check its actual contents and the number pressed as follows:
var inputNode = document.getElementById('my_account');
inputNode.addEventListener('keydown', (event) => {
var inputValue = event.key;
var inputNodeValue = inputNode.value;
var length = inputNodeValue.length;
if (length === 1 && inputNodeValue[0] === inputValue) {
event.preventDefault();
}
});
submit, , .