How to find the key code for a specific key

后端 未结 11 2098
猫巷女王i
猫巷女王i 2020-12-28 09:29

What\'s the easiest way to find the keycode for a specific key press?

Are there any good online tools that just capture any key event and show the code?

I wa

11条回答
  •  执念已碎
    2020-12-28 10:20

    Please try this.

    $('input').on('keyup', function(e){
       var key_code = e.which || e.keyCode;
       console.log(key_code );
    });
    

    For better help please follow the below link http://www.w3schools.com/jsref/event_key_keycode.asp

提交回复
热议问题