Detecting “value” of input text field after a keydown event in the text field?

后端 未结 6 782
死守一世寂寞
死守一世寂寞 2020-12-08 08:04

So my site has an input box, which has a onkeydown event that merely alerts the value of the input box.

Unfortunately the value of the input does not include the ch

6条回答
  •  情歌与酒
    2020-12-08 08:37

    Jquery is the optimal way of doing this. Please reference the following below:

    let fieldText = $('#id');
    let fieldVal = fieldText.val();
    
    fieldText.on('keydown', function() {
       fieldVal.val();
    });
    

提交回复
热议问题