How to get the new value of an HTML input after a keypress has modified it?

后端 未结 6 1768
北恋
北恋 2021-02-05 03:24

I have an HTML input box


I\'ve attached a handler for the \'keyup\' event, but if

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 03:57

    Here is a table of the different events and the levels of browser support. You need to pick an event which is supported across at least all modern browsers.

    As you will see from the table, the keypress and change event do not have uniform support whereas the keyup event does.

    Also make sure you attach the event handler using a cross-browser-compatible method...

提交回复
热议问题