myInput.value is one keystroke behind when I examine it in a keyPress event handler. So if the users types \"a\", myInput.value gives me \"\". Then when the user types \"b\"
Use the keyUp event, it should definitely give you the value you are looking for.