Who used the input event? How do I get the characters I entered in the inpu event object?

  node.js, question

Who used the input event? How do I get the characters I entered in the inpu event object?

The answer is no, I need to judge the current pressed value. I can’t detect the press of backspace like you.

Wechat does not support keyup, keydown and keyup,keydown,keypress, so keyCode is invalid.

html

<input type="text" id="test">

javascript

// jquery
 $('#test').on('keyup', function(event) {
 console.log(event.key)
 })
 
 //Native
 var input = document.getElementById("test")
 input.addEventListener('keyup', function(event) {
 console.log(event.key)
 })

图片描述