HTML · JavaScript · JQuery · ruby · Ruby On Rails

Handling Keyboard Shortcuts in Rails or HTML

Handling keyboard shortcuts in a Rails app, HTML using javascript is pretty simple. Just download a shortcut.js from the following URL : http://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js Rails :- Paste the file in the /public/javascripts folder Write the following code in your view / layout file before <body> tag. <head> <script src=”/javascripts/shortcut.js” type=”text/javascript”></script> <script type=”text/javascript”> shortcut.add(“Ctrl+Shift+X”,function() {alert(“You Pressed Ctrl+Shift+X!”);});… Continue reading Handling Keyboard Shortcuts in Rails or HTML