javascript - Left and right arrow keys not registering onkeypress -


i have on key event fires fine , registers space bar when pressed, left , right arrow keys nothing, don't fire.

$('html').keypress(function(e) {              if(e.which == 32) { event.preventdefault(); app.playpausetoggle() }              else if(e.which == 37) { event.preventdefault(); app.changetrack('previous') }              else if(e.which == 39) { event.preventdefault(); app.changetrack('next'); }          }) 

i'm key codes fine: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

i've tried console.log tests under ifs , nothing either.

.keypress ignores arrow keys, you're going want use .keydown instead.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -