Home >Web Front-end >JS Tutorial >js textInput text event in DOM3_javascript skills
Unlike keypress, this event is only triggered when the user enters visual characters, while the keypres event is triggered as long as a key is pressed (such as CapsLock, Backspace).
You can see that textInput mainly considers characters, and the input characters can be obtained through the data attribute of the event object.
Example