Get key value of a key pressed

后端 未结 8 2143
别那么骄傲
别那么骄傲 2021-01-05 01:14

I don\'t find how to get the value of a key pressed. I currently have

$(\'#info_price\').bind(\'keydown\',function(evt){
    alert(evt.keyCode);
         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 01:27

    As it's told in comment it's ASCII code. To get it as character you can do:

    alert(String.fromCharCode(evt.keyCode));
    

提交回复
热议问题