getting the value of a form field after keypress event

前端 未结 2 435
小鲜肉
小鲜肉 2021-01-11 10:46

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\"

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-11 11:42

    Use the keyUp event, it should definitely give you the value you are looking for.

提交回复
热议问题