Is the shiftkey held down in JavaScript

后端 未结 3 1681
面向向阳花
面向向阳花 2020-12-19 07:15

I have written a JS function that only allow numbers to be entered. A copy of that function is below:

function NumbersOnly(e) {
    var evt = e || window.eve         


        
3条回答
  •  时光说笑
    2020-12-19 08:18

    You can check if shift key is pressed using :

    if(evt.shiftKey) {
     ...  //returns true if shift key is pressed
    

提交回复
热议问题