Home » Php » php – How to implement keyboard shortcuts on websites

php – How to implement keyboard shortcuts on websites

Posted by: admin July 12, 2020 Leave a comment

Questions:

Where should I begin if I want users to be able to use keyboard shortcuts on a site.
I’m currently using php and jquery to create site. How will I be able to add keyboard shortcuts aside from the usual point and click method. Links to site where I could begin will do. Thanks.

How to&Answers:

As a starter: http://plugins.jquery.com/project/hotkeys

[Edit 1/14/14: Dead link. See the Github page instead]

Answer:

I’ve used jQuery.hotkeys by John Resig, and it works pretty well with the latest jQuery. Have a look at the static page samples on the github page.

Answer:

Maybe also look into using the accesskey attribute.

Answer:

Take a look at Mousetrap as well.

http://craig.is/killing/mice

It supports all types of key events as well as combinations and sequences.

Answer:

Try this plugin http://www.mattytemple.com/projects/shortcut-js/. It is simplistic in purpose and handles single combinations effectively.

If you need better implementation with more flexibility go for Mousetrap Plugin as specified by @craig in the previous answer.