Enable and disable shift and ctrl key with some of there comibinations


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //diable shift key
  2.  
  3. e.ShiftKey = false;
  4.  
  5. //Enable shift key with ARROW key left(37) and right(39)
  6. if (e.shiftKey) {
  7.  
  8. if(e.keyCode == 37 || e.keyCode == 39)
  9. {
  10. return true;
  11. }
  12.  
  13. }
  14. //Enable Ctrl key with A (Ctrl+A)
  15. if (isCtrl == true && e.which == '65') { return true; }
  16. (for chrome)
  17. if (e.ctrlKey == true && e.keyCode == '65') { return true; }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.