Created
February 8, 2011 16:45
-
-
Save oslego/816721 to your computer and use it in GitHub Desktop.
Method for handling keypress events on non-input elements in Safari (and other webkit-based browsers)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var div = document.getElementById("demo"); | |
div.setAttribute("tabIndex", 0); | |
div.focus(); | |
div.addEventListener("keypress", function(e){ | |
console.log(e.keyCode); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment