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", myInput.value gives me "a", and so on. The value doesn’t seem to get updated with the character input by the keystroke that triggered the event. What am I doing wrong?
myInput.value is one keystroke behind when I examine it in a keyPress event handler.
Share
Use the keyUp event, it should definitely give you the value you are looking for.